|
15 | 15 |
|
16 | 16 | namespace ipc { |
17 | 17 |
|
18 | | -class CollisionsBase { |
19 | | -public: |
20 | | - CollisionsBase() = default; |
21 | | - virtual ~CollisionsBase() = default; |
22 | | - |
23 | | - virtual std::shared_ptr<CollisionsBase> deepcopy() const = 0; |
24 | | - |
25 | | - /// @brief Get the number of collisions. |
26 | | - virtual size_t size() const = 0; |
27 | | - |
28 | | - /// @brief Get if the collision set are empty. |
29 | | - virtual bool empty() const = 0; |
30 | | - |
31 | | - /// @brief Clear the collision set. |
32 | | - virtual void clear() = 0; |
33 | | - |
34 | | - /// @brief Computes the minimum distance between any non-adjacent elements. |
35 | | - /// @param mesh The collision mesh. |
36 | | - /// @param vertices Vertices of the collision mesh. |
37 | | - /// @returns The minimum distance between any non-adjacent elements. |
38 | | - virtual double compute_minimum_distance( |
39 | | - const CollisionMesh& mesh, Eigen::ConstRef<Eigen::MatrixXd> vertices) const = 0; |
40 | | - |
41 | | - /// @brief Get if the collision set are using the convergent formulation. |
42 | | - /// @note If not empty, this is the current value not necessarily the value used to build the collisions. |
43 | | - /// @return If the collision set are using the convergent formulation. |
44 | | - bool are_shape_derivatives_enabled() const |
45 | | - { |
46 | | - return m_are_shape_derivatives_enabled; |
47 | | - } |
48 | | - |
49 | | - /// @brief Set if the collision set should enable shape derivative computation. |
50 | | - /// @warning This must be set before the collisions are built. |
51 | | - /// @param are_shape_derivatives_enabled If the collision set should enable shape derivative computation. |
52 | | - void |
53 | | - set_are_shape_derivatives_enabled(const bool are_shape_derivatives_enabled) |
54 | | - { |
55 | | - if (!empty() |
56 | | - && are_shape_derivatives_enabled |
57 | | - != m_are_shape_derivatives_enabled) { |
58 | | - logger().warn( |
59 | | - "Setting enable_shape_derivatives after building collisions. " |
60 | | - "Re-build collisions for this to have an effect."); |
61 | | - } |
62 | | - |
63 | | - m_are_shape_derivatives_enabled = are_shape_derivatives_enabled; |
64 | | - } |
65 | | - |
66 | | -protected: |
67 | | - bool m_use_convergent_formulation = false; |
68 | | - bool m_are_shape_derivatives_enabled = false; |
69 | | -}; |
70 | | - |
71 | | -class NormalCollisions : public CollisionsBase { |
| 18 | +class NormalCollisions { |
72 | 19 | public: |
73 | 20 | /// @brief The type of the collisions. |
74 | 21 | using value_type = NormalCollision; |
75 | 22 |
|
76 | 23 | public: |
77 | 24 | NormalCollisions() = default; |
78 | 25 |
|
79 | | - std::shared_ptr<CollisionsBase> deepcopy() const override |
80 | | - { |
81 | | - return std::make_shared<NormalCollisions>(*this); |
82 | | - } |
83 | | - |
84 | 26 | /// @brief Initialize the set of collisions used to compute the barrier potential. |
85 | 27 | /// @param mesh The collision mesh. |
86 | 28 | /// @param vertices Vertices of the collision mesh. |
@@ -116,18 +58,18 @@ class NormalCollisions : public CollisionsBase { |
116 | 58 | /// @returns The minimum distance between any non-adjacent elements. |
117 | 59 | double compute_minimum_distance( |
118 | 60 | const CollisionMesh& mesh, |
119 | | - Eigen::ConstRef<Eigen::MatrixXd> vertices) const override; |
| 61 | + Eigen::ConstRef<Eigen::MatrixXd> vertices) const; |
120 | 62 |
|
121 | 63 | // ------------------------------------------------------------------------ |
122 | 64 |
|
123 | 65 | /// @brief Get the number of collisions. |
124 | | - size_t size() const override; |
| 66 | + size_t size() const; |
125 | 67 |
|
126 | 68 | /// @brief Get if the collision set are empty. |
127 | | - bool empty() const override; |
| 69 | + bool empty() const; |
128 | 70 |
|
129 | 71 | /// @brief Clear the collision set. |
130 | | - void clear() override; |
| 72 | + void clear(); |
131 | 73 |
|
132 | 74 | /// @brief Get a reference to collision at index i. |
133 | 75 | /// @param i The index of the collision. |
|
0 commit comments