forked from RobotLocomotion/drake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
internal_geometry.cc
76 lines (67 loc) · 2.27 KB
/
internal_geometry.cc
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
#include "drake/geometry/internal_geometry.h"
#include <memory>
#include "drake/common/drake_assert.h"
#include "drake/geometry/make_mesh_for_deformable.h"
namespace drake {
namespace geometry {
namespace internal {
using math::RigidTransform;
InternalGeometry::InternalGeometry(SourceId source_id,
std::unique_ptr<Shape> shape,
FrameId frame_id, GeometryId geometry_id,
std::string name,
RigidTransform<double> X_FG)
: shape_spec_(std::move(shape)),
id_(geometry_id),
name_(std::move(name)),
source_id_(source_id),
frame_id_(frame_id),
X_FG_(std::move(X_FG)) {}
InternalGeometry::InternalGeometry(SourceId source_id,
std::unique_ptr<Shape> shape,
FrameId frame_id, GeometryId geometry_id,
std::string name,
RigidTransform<double> X_FG,
double resolution_hint)
: shape_spec_(std::move(shape)),
id_(geometry_id),
name_(std::move(name)),
source_id_(source_id),
frame_id_(frame_id),
X_FG_(std::move(X_FG)) {
// The function creates the mesh in frame G.
reference_mesh_ = MakeMeshForDeformable(*shape_spec_, resolution_hint);
}
bool InternalGeometry::has_role(Role role) const {
switch (role) {
case Role::kProximity:
return has_proximity_role();
case Role::kIllustration:
return has_illustration_role();
case Role::kPerception:
return has_perception_role();
case Role::kUnassigned:
return !(has_proximity_role() || has_perception_role() ||
has_illustration_role());
}
DRAKE_UNREACHABLE();
}
const GeometryProperties* InternalGeometry::properties(Role role) const {
switch (role) {
case Role::kUnassigned:
return nullptr;
case Role::kProximity:
return proximity_properties();
break;
case Role::kIllustration:
return illustration_properties();
break;
case Role::kPerception:
return perception_properties();
break;
}
DRAKE_UNREACHABLE();
}
} // namespace internal
} // namespace geometry
} // namespace drake