38 #ifndef FCL_SHAPE_CAPSULE_INL_H 39 #define FCL_SHAPE_CAPSULE_INL_H 41 #include "fcl/geometry/shape/capsule.h" 48 class Capsule<double>;
94 return Vector3<S>(ix, ix, iz).asDiagonal();
100 const Transform3<S>& tf)
const 102 std::vector<Vector3<S>> result(36);
103 const auto m = (1 + std::sqrt(5.0)) / 2.0;
106 auto edge_size =
radius * 6 / (std::sqrt(27.0) + std::sqrt(15.0));
108 auto b = m * edge_size;
109 auto r2 =
radius * 2 / std::sqrt(3.0);
111 result[0] = tf * Vector3<S>(0, a, b + hl);
112 result[1] = tf * Vector3<S>(0, -a, b + hl);
113 result[2] = tf * Vector3<S>(0, a, -b + hl);
114 result[3] = tf * Vector3<S>(0, -a, -b + hl);
115 result[4] = tf * Vector3<S>(a, b, hl);
116 result[5] = tf * Vector3<S>(-a, b, hl);
117 result[6] = tf * Vector3<S>(a, -b, hl);
118 result[7] = tf * Vector3<S>(-a, -b, hl);
119 result[8] = tf * Vector3<S>(b, 0, a + hl);
120 result[9] = tf * Vector3<S>(b, 0, -a + hl);
121 result[10] = tf * Vector3<S>(-b, 0, a + hl);
122 result[11] = tf * Vector3<S>(-b, 0, -a + hl);
124 result[12] = tf * Vector3<S>(0, a, b - hl);
125 result[13] = tf * Vector3<S>(0, -a, b - hl);
126 result[14] = tf * Vector3<S>(0, a, -b - hl);
127 result[15] = tf * Vector3<S>(0, -a, -b - hl);
128 result[16] = tf * Vector3<S>(a, b, -hl);
129 result[17] = tf * Vector3<S>(-a, b, -hl);
130 result[18] = tf * Vector3<S>(a, -b, -hl);
131 result[19] = tf * Vector3<S>(-a, -b, -hl);
132 result[20] = tf * Vector3<S>(b, 0, a - hl);
133 result[21] = tf * Vector3<S>(b, 0, -a - hl);
134 result[22] = tf * Vector3<S>(-b, 0, a - hl);
135 result[23] = tf * Vector3<S>(-b, 0, -a - hl);
139 result[24] = tf * Vector3<S>(r2, 0, hl);
140 result[25] = tf * Vector3<S>(c, d, hl);
141 result[26] = tf * Vector3<S>(-c, d, hl);
142 result[27] = tf * Vector3<S>(-r2, 0, hl);
143 result[28] = tf * Vector3<S>(-c, -d, hl);
144 result[29] = tf * Vector3<S>(c, -d, hl);
146 result[30] = tf * Vector3<S>(r2, 0, -hl);
147 result[31] = tf * Vector3<S>(c, d, -hl);
148 result[32] = tf * Vector3<S>(-c, d, -hl);
149 result[33] = tf * Vector3<S>(-r2, 0, -hl);
150 result[34] = tf * Vector3<S>(-c, -d, -hl);
151 result[35] = tf * Vector3<S>(c, -d, -hl);
Vector3< S_ > aabb_center
AABB center in local coordinate.
Definition: collision_geometry.h:91
NODE_TYPE
traversal node type: bounding volume (AABB, OBB, RSS, kIOS, OBBRSS, KDOP16, KDOP18, kDOP24), basic shape (box, sphere, ellipsoid, capsule, cone, cylinder, convex, plane, halfspace, triangle), and octree
Definition: collision_geometry.h:54
Main namespace.
Definition: broadphase_bruteforce-inl.h:45
S lz
Length along z axis.
Definition: capsule.h:61
Base class for all basic geometric shapes.
Definition: shape_base.h:48
S computeVolume() const override
compute the volume
Definition: capsule-inl.h:79
S_ aabb_radius
AABB radius.
Definition: collision_geometry.h:94
std::vector< Vector3< S > > getBoundVertices(const Transform3< S > &tf) const
get the vertices of some convex shape which can bound this shape in a specific configuration ...
Definition: capsule-inl.h:99
void computeLocalAABB() override
Compute AABB<S>
Definition: capsule-inl.h:60
static constexpr S pi()
The mathematical constant pi.
Definition: constants.h:49
AABB< S_ > aabb_local
AABB in local coordinate, used for tight AABB when only translation transform.
Definition: collision_geometry.h:97
NODE_TYPE getNodeType() const override
Get node type: a capsule.
Definition: capsule-inl.h:72
Matrix3< S > computeMomentofInertia() const override
compute the inertia matrix, related to the origin
Definition: capsule-inl.h:86
S radius
Radius of capsule.
Definition: capsule.h:58
Capsule(S radius, S lz)
Constructor.
Definition: capsule-inl.h:52