-
Notifications
You must be signed in to change notification settings - Fork 48
Expand file tree
/
Copy pathnormal_collisions.cpp
More file actions
162 lines (143 loc) · 6.04 KB
/
normal_collisions.cpp
File metadata and controls
162 lines (143 loc) · 6.04 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
#include <common.hpp>
#include <ipc/collisions/normal/normal_collisions.hpp>
using namespace ipc;
void define_normal_collisions(py::module_& m)
{
py::class_<NormalCollisions>(m, "NormalCollisions")
.def(py::init())
.def(
"build",
py::overload_cast<
const CollisionMesh&, Eigen::ConstRef<Eigen::MatrixXd>,
const double, const double, const std::shared_ptr<BroadPhase>&>(
&NormalCollisions::build),
R"ipc_Qu8mg5v7(
Initialize the set of collisions used to compute the barrier potential.
Parameters:
mesh: The collision mesh.
vertices: Vertices of the collision mesh.
dhat: The activation distance of the barrier.
dmin: Minimum distance.
broad_phase: Broad-phase to use.
)ipc_Qu8mg5v7",
"mesh"_a, "vertices"_a, "dhat"_a, "dmin"_a = 0,
"broad_phase"_a = make_default_broad_phase())
.def(
"build",
py::overload_cast<
const Candidates&, const CollisionMesh&,
Eigen::ConstRef<Eigen::MatrixXd>, const double, const double>(
&NormalCollisions::build),
R"ipc_Qu8mg5v7(
Initialize the set of collisions used to compute the barrier potential.
Parameters:
candidates: Distance candidates from which the collision set is built.
mesh: The collision mesh.
vertices: Vertices of the collision mesh.
dhat: The activation distance of the barrier.
dmin: Minimum distance.
)ipc_Qu8mg5v7",
"candidates"_a, "mesh"_a, "vertices"_a, "dhat"_a, "dmin"_a = 0)
.def(
"compute_minimum_distance",
&NormalCollisions::compute_minimum_distance,
R"ipc_Qu8mg5v7(
Computes the minimum distance between any non-adjacent elements.
Parameters:
mesh: The collision mesh.
vertices: Vertices of the collision mesh.
Returns:
The minimum distance between any non-adjacent elements.
)ipc_Qu8mg5v7",
"mesh"_a, "vertices"_a)
.def(
"__len__", &NormalCollisions::size, "Get the number of collisions.")
.def(
"empty", &NormalCollisions::empty,
"Get if the collision set are empty.")
.def("clear", &NormalCollisions::clear, "Clear the collision set.")
.def(
"__getitem__",
[](NormalCollisions& self, size_t i) -> NormalCollision& {
return self[i];
},
py::return_value_policy::reference,
R"ipc_Qu8mg5v7(
Get a reference to collision at index i.
Parameters:
i: The index of the collision.
Returns:
A reference to the collision.
)ipc_Qu8mg5v7",
"i"_a)
.def(
"is_vertex_vertex", &NormalCollisions::is_vertex_vertex,
R"ipc_Qu8mg5v7(
Get if the collision at i is a vertex-vertex collision.
Parameters:
i: The index of the collision.
Returns:
If the collision at i is a vertex-vertex collision.
)ipc_Qu8mg5v7",
"i"_a)
.def(
"is_edge_vertex", &NormalCollisions::is_edge_vertex,
R"ipc_Qu8mg5v7(
Get if the collision at i is an edge-vertex collision.
Parameters:
i: The index of the collision.
Returns:
If the collision at i is an edge-vertex collision.
)ipc_Qu8mg5v7",
"i"_a)
.def(
"is_edge_edge", &NormalCollisions::is_edge_edge,
R"ipc_Qu8mg5v7(
Get if the collision at i is an edge-edge collision.
Parameters:
i: The index of the collision.
Returns:
If the collision at i is an edge-edge collision.
)ipc_Qu8mg5v7",
"i"_a)
.def(
"is_face_vertex", &NormalCollisions::is_face_vertex,
R"ipc_Qu8mg5v7(
Get if the collision at i is an face-vertex collision.
Parameters:
i: The index of the collision.
Returns:
If the collision at i is an face-vertex collision.
)ipc_Qu8mg5v7",
"i"_a)
.def(
"is_plane_vertex", &NormalCollisions::is_plane_vertex,
R"ipc_Qu8mg5v7(
Get if the collision at i is an plane-vertex collision.
Parameters:
i: The index of the collision.
Returns:
If the collision at i is an plane-vertex collision.
)ipc_Qu8mg5v7",
"i"_a)
.def("__str__", &NormalCollisions::to_string, "mesh"_a, "vertices"_a)
.def_property(
"use_area_weighting", &NormalCollisions::use_area_weighting,
&NormalCollisions::set_use_area_weighting,
"If the NormalCollisions should use the convergent formulation.")
.def_property(
"use_improved_max_approximator",
&NormalCollisions::use_improved_max_approximator,
&NormalCollisions::set_use_improved_max_approximator,
"If the NormalCollisions should use the improved max approximator.")
.def_property(
"enable_shape_derivatives",
&NormalCollisions::enable_shape_derivatives,
&NormalCollisions::set_enable_shape_derivatives,
"If the NormalCollisions are using the convergent formulation.")
.def_readwrite("vv_collisions", &NormalCollisions::vv_collisions)
.def_readwrite("ev_collisions", &NormalCollisions::ev_collisions)
.def_readwrite("ee_collisions", &NormalCollisions::ee_collisions)
.def_readwrite("fv_collisions", &NormalCollisions::fv_collisions)
.def_readwrite("pv_collisions", &NormalCollisions::pv_collisions);
}