38 #ifndef FCL_SHAPE_SPHERE_INL_H 39 #define FCL_SHAPE_SPHERE_INL_H 41 #include "fcl/geometry/shape/sphere.h" 52 Sphere<S>::Sphere(S radius) : ShapeBase<S>(), radius(radius)
79 return Vector3<S>::Constant(I).asDiagonal();
92 const Transform3<S>& tf)
const 96 std::vector<Vector3<S>> result(12);
97 const auto m = (1 + std::sqrt(5.0)) / 2.0;
98 auto edge_size = radius * 6 / (std::sqrt(27.0) + std::sqrt(15.0));
101 auto b = m * edge_size;
102 result[0] = tf * Vector3<S>(0, a, b);
103 result[1] = tf * Vector3<S>(0, -a, b);
104 result[2] = tf * Vector3<S>(0, a, -b);
105 result[3] = tf * Vector3<S>(0, -a, -b);
106 result[4] = tf * Vector3<S>(a, b, 0);
107 result[5] = tf * Vector3<S>(-a, b, 0);
108 result[6] = tf * Vector3<S>(a, -b, 0);
109 result[7] = tf * Vector3<S>(-a, -b, 0);
110 result[8] = tf * Vector3<S>(b, 0, a);
111 result[9] = tf * Vector3<S>(b, 0, -a);
112 result[10] = tf * Vector3<S>(-b, 0, a);
113 result[11] = tf * Vector3<S>(-b, 0, -a);
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_ aabb_radius
AABB radius.
Definition: collision_geometry.h:94
Matrix3< S > computeMomentofInertia() const override
compute the inertia matrix, related to the origin
Definition: sphere-inl.h:75
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: sphere-inl.h:91
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
void computeLocalAABB() override
Compute AABB<S>
Definition: sphere-inl.h:58
virtual S_ computeVolume() const
compute the volume
S computeVolume() const override
compute the volume
Definition: sphere-inl.h:84
NODE_TYPE getNodeType() const override
Get node type: a sphere.
Definition: sphere-inl.h:69