38 #ifndef FCL_SHAPE_ELLIPSOID_INL_H 39 #define FCL_SHAPE_ELLIPSOID_INL_H 98 return Vector3<S>(0.2 * (b2 + c2), 0.2 * (a2 + c2), 0.2 * (a2 + b2)).asDiagonal();
102 template <
typename S>
110 template <
typename S>
116 std::vector<Vector3<S>> result(12);
118 const auto phi = (1.0 + std::sqrt(5.0)) / 2.0;
120 const auto a = std::sqrt(3.0) / (phi * phi);
121 const auto b = phi * a;
123 const auto& A =
radii[0];
124 const auto& B =
radii[1];
125 const auto& C =
radii[2];
127 const auto Aa = A * a;
128 const auto Ab = A * b;
129 const auto Ba = B * a;
130 const auto Bb = B * b;
131 const auto Ca = C * a;
132 const auto Cb = C * b;
135 result[1] = tf * Vector3<S>(0, -Ba, Cb);
136 result[2] = tf * Vector3<S>(0, Ba, -Cb);
137 result[3] = tf * Vector3<S>(0, -Ba, -Cb);
138 result[4] = tf * Vector3<S>(Aa, Bb, 0);
139 result[5] = tf * Vector3<S>(-Aa, Bb, 0);
140 result[6] = tf * Vector3<S>(Aa, -Bb, 0);
141 result[7] = tf * Vector3<S>(-Aa, -Bb, 0);
142 result[8] = tf * Vector3<S>(Ab, 0, Ca);
143 result[9] = tf * Vector3<S>(Ab, 0, -Ca);
144 result[10] = tf * Vector3<S>(-Ab, 0, Ca);
145 result[11] = tf * Vector3<S>(-Ab, 0, -Ca);
151 template <
typename S>
154 std::stringstream ss;
155 ss << std::setprecision(precision);
156 ss <<
"Ellipsoid<" << S_str <<
">(" <<
radii[0] <<
", " <<
radii[1] <<
", " Vector3< S_ > aabb_center
AABB center in local coordinate.
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
Matrix3< S > computeMomentofInertia() const override
compute the inertia matrix, related to the origin
Base class for all basic geometric shapes.
void computeLocalAABB() override
Compute AABB.
S_ aabb_radius
AABB radius.
static const char * value()
Eigen::Transform< S, 3, Eigen::Isometry > Transform3
NODE_TYPE getNodeType() const override
Get node type: a sphere.
S computeVolume() const override
compute the volume
Eigen::Matrix< S, 3, 3 > Matrix3
Eigen::Matrix< S, 3, 1 > Vector3
Ellipsoid(S a, S b, S c)
Constructor.
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 ...
template class FCL_EXPORT Ellipsoid< double >
static constexpr S pi()
The mathematical constant pi.
AABB< S_ > aabb_local
AABB in local coordinate, used for tight AABB when only translation transform.
Vector3< S > radii
Radii of the ellipsoid.
std::string representation(int precision=20) const
Create a string that should be sufficient to recreate this shape. This is akin to the repr() implemen...