38 #ifndef FCL_SHAPE_CAPSULE_INL_H 39 #define FCL_SHAPE_CAPSULE_INL_H 66 const Vector3<S> v_delta(radius, radius, 0.5 * lz + radius);
67 this->aabb_local.max_ = v_delta;
68 this->aabb_local.min_ = -v_delta;
70 this->aabb_center = this->aabb_local.center();
71 this->aabb_radius = (this->aabb_local.min_ - this->aabb_center).norm();
94 S r2 = radius * radius;
97 S v_sph = r2 * radius * constants<S>::pi() * 4 / 3.0;
99 S ix = v_cyl * (l2 / 12. + r2 / 4.) + v_sph * (0.4 * r2 + 0.25 * l2 + 3. * radius * lz / 8.);
100 S iz = (0.5 * v_cyl + 0.4 * v_sph) * r2;
106 template <
typename S>
110 std::vector<Vector3<S>> result(36);
111 const auto m = (1 + std::sqrt(5.0)) / 2.0;
114 auto edge_size = radius * 6 / (std::sqrt(27.0) + std::sqrt(15.0));
116 auto b = m * edge_size;
117 auto r2 = radius * 2 / std::sqrt(3.0);
120 result[1] = tf * Vector3<S>(0, -a, b + hl);
121 result[2] = tf * Vector3<S>(0, a, -b + hl);
122 result[3] = tf * Vector3<S>(0, -a, -b + hl);
123 result[4] = tf * Vector3<S>(a, b, hl);
124 result[5] = tf * Vector3<S>(-a, b, hl);
125 result[6] = tf * Vector3<S>(a, -b, hl);
126 result[7] = tf * Vector3<S>(-a, -b, hl);
127 result[8] = tf * Vector3<S>(b, 0, a + hl);
128 result[9] = tf * Vector3<S>(b, 0, -a + hl);
129 result[10] = tf * Vector3<S>(-b, 0, a + hl);
130 result[11] = tf * Vector3<S>(-b, 0, -a + hl);
132 result[12] = tf * Vector3<S>(0, a, b - hl);
133 result[13] = tf * Vector3<S>(0, -a, b - hl);
134 result[14] = tf * Vector3<S>(0, a, -b - hl);
135 result[15] = tf * Vector3<S>(0, -a, -b - hl);
136 result[16] = tf * Vector3<S>(a, b, -hl);
137 result[17] = tf * Vector3<S>(-a, b, -hl);
138 result[18] = tf * Vector3<S>(a, -b, -hl);
139 result[19] = tf * Vector3<S>(-a, -b, -hl);
140 result[20] = tf * Vector3<S>(b, 0, a - hl);
141 result[21] = tf * Vector3<S>(b, 0, -a - hl);
142 result[22] = tf * Vector3<S>(-b, 0, a - hl);
143 result[23] = tf * Vector3<S>(-b, 0, -a - hl);
147 result[24] = tf * Vector3<S>(r2, 0, hl);
148 result[25] = tf * Vector3<S>(c, d, hl);
149 result[26] = tf * Vector3<S>(-c, d, hl);
150 result[27] = tf * Vector3<S>(-r2, 0, hl);
151 result[28] = tf * Vector3<S>(-c, -d, hl);
152 result[29] = tf * Vector3<S>(c, -d, hl);
154 result[30] = tf * Vector3<S>(r2, 0, -hl);
155 result[31] = tf * Vector3<S>(c, d, -hl);
156 result[32] = tf * Vector3<S>(-c, d, -hl);
157 result[33] = tf * Vector3<S>(-r2, 0, -hl);
158 result[34] = tf * Vector3<S>(-c, -d, -hl);
159 result[35] = tf * Vector3<S>(c, -d, -hl);
165 template <
typename S>
168 std::stringstream ss;
169 ss << std::setprecision(precision);
170 ss <<
"Capsule<" << S_str <<
">(" << radius <<
", " << lz <<
");";
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
Base class for all basic geometric shapes.
Eigen::Transform< S, 3, Eigen::Isometry > Transform3
Eigen::Matrix< S, 3, 3 > Matrix3
Eigen::Matrix< S, 3, 1 > Vector3
Center at zero point capsule.
template class FCL_EXPORT Capsule< double >
Capsule(S radius, S lz)
Constructor.