forked from doyubkim/fluid-engine-dev
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcollider_set3.h
70 lines (50 loc) · 1.73 KB
/
collider_set3.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// Copyright (c) 2018 Doyub Kim
//
// I am making my contributions/submissions to this project solely in my
// personal capacity and am not conveying any rights to any intellectual
// property of any third parties.
#ifndef INCLUDE_JET_COLLIDER_SET3_H_
#define INCLUDE_JET_COLLIDER_SET3_H_
#include <jet/collider3.h>
#include <jet/surface_set3.h>
#include <vector>
namespace jet {
//! Collection of 3-D colliders
class ColliderSet3 final : public Collider3 {
public:
class Builder;
//! Default constructor.
ColliderSet3();
//! Constructs with other colliders.
explicit ColliderSet3(const std::vector<Collider3Ptr>& others);
//! Returns the velocity of the collider at given \p point.
Vector3D velocityAt(const Vector3D& point) const override;
//! Adds a collider to the set.
void addCollider(const Collider3Ptr& collider);
//! Returns number of colliders.
size_t numberOfColliders() const;
//! Returns collider at index \p i.
Collider3Ptr collider(size_t i) const;
//! Returns builder fox ColliderSet3.
static Builder builder();
private:
std::vector<Collider3Ptr> _colliders;
};
//! Shared pointer for the ColliderSet3 type.
typedef std::shared_ptr<ColliderSet3> ColliderSet3Ptr;
//!
//! \brief Front-end to create ColliderSet3 objects step by step.
//!
class ColliderSet3::Builder final {
public:
//! Returns builder with other colliders.
Builder& withColliders(const std::vector<Collider3Ptr>& others);
//! Builds ColliderSet3.
ColliderSet3 build() const;
//! Builds shared pointer of ColliderSet3 instance.
ColliderSet3Ptr makeShared() const;
private:
std::vector<Collider3Ptr> _colliders;
};
} // namespace jet
#endif // INCLUDE_JET_COLLIDER_SET3_H_