ColliderSet3.h
Go to the documentation of this file.
1 /*************************************************************************
2 > File Name: ColliderSet3.h
3 > Project Name: CubbyFlow
4 > Author: Chan-Ho Chris Ohk
5 > Purpose: Collection of 3-D colliders.
6 > Created Time: 2017/05/09
7 > Copyright (c) 2018, Chan-Ho Chris Ohk
8 *************************************************************************/
9 #ifndef CUBBYFLOW_COLLIDER_SET3_H
10 #define CUBBYFLOW_COLLIDER_SET3_H
11 
13 
14 #include <vector>
15 
16 namespace CubbyFlow
17 {
19  class ColliderSet3 final : public Collider3
20  {
21  public:
22  class Builder;
23 
25  ColliderSet3();
26 
28  explicit ColliderSet3(const std::vector<Collider3Ptr>& others);
29 
31  Vector3D VelocityAt(const Vector3D& point) const override;
32 
34  void AddCollider(const Collider3Ptr& collider);
35 
37  size_t NumberOfColliders() const;
38 
40  Collider3Ptr Collider(size_t i) const;
41 
43  static Builder GetBuilder();
44 
45  private:
46  std::vector<Collider3Ptr> m_colliders;
47  };
48 
50  using ColliderSet3Ptr = std::shared_ptr<ColliderSet3>;
51 
56  {
57  public:
59  Builder& WithColliders(const std::vector<Collider3Ptr>& others);
60 
62  ColliderSet3 Build() const;
63 
66 
67  private:
68  std::vector<Collider3Ptr> m_colliders;
69  };
70 }
71 
72 #endif
3-D vector class.
Definition: Vector3.h:26
Vector3D VelocityAt(const Vector3D &point) const override
Returns the velocity of the collider at given point.
std::shared_ptr< Collider3 > Collider3Ptr
Shared pointer type for the Collider3.
Definition: Collider3.h:112
std::shared_ptr< ColliderSet3 > ColliderSet3Ptr
Shared pointer for the ColliderSet3 type.
Definition: ColliderSet3.h:50
size_t NumberOfColliders() const
Returns number of colliders.
ColliderSet3 Build() const
Builds ColliderSet3.
ColliderSet3Ptr MakeShared() const
Builds shared pointer of ColliderSet3 instance.
Builder & WithColliders(const std::vector< Collider3Ptr > &others)
Returns builder with other colliders.
ColliderSet3()
Default constructor.
void AddCollider(const Collider3Ptr &collider)
Adds a collider to the set.
Definition: pybind11Utils.h:24
Collider3Ptr Collider(size_t i) const
Returns collider at index i.
static Builder GetBuilder()
Returns builder fox ColliderSet3.
Collection of 3-D colliders.
Definition: ColliderSet3.h:19
Abstract base class for generic collider object.
Definition: Collider3.h:27
Front-end to create ColliderSet3 objects step by step.
Definition: ColliderSet3.h:55