|
hpp-fcl
1.6.0
HPP fork of FCL -- The Flexible Collision Library
|
Go to the documentation of this file.
39 #ifndef HPP_FCL_GEOMETRIC_SHAPES_H
40 #define HPP_FCL_GEOMETRIC_SHAPES_H
42 #include <boost/math/constants/constants.hpp>
110 return 8*halfSide.prod();
116 Vec3f s (halfSide.cwiseAbs2() * V);
117 return (
Vec3f (s[1] + s[2], s[0] + s[2], s[0] + s[1]) / 3).asDiagonal();
140 FCL_REAL I = 0.4 * radius * radius * computeVolume();
141 return I * Matrix3f::Identity();
146 return 4 * boost::math::constants::pi<FCL_REAL>() * radius * radius * radius / 3;
176 return boost::math::constants::pi<FCL_REAL>() * radius * radius *((halfLength * 2) + radius * 4/3.0);
181 FCL_REAL v_cyl = radius * radius * (halfLength * 2) * boost::math::constants::pi<FCL_REAL>();
182 FCL_REAL v_sph = radius * radius * radius * boost::math::constants::pi<FCL_REAL>() * 4 / 3.0;
184 FCL_REAL h2 = halfLength * halfLength;
186 FCL_REAL ix = v_cyl * (h2 / 3. + r2 / 4.) + v_sph * (0.4 * r2 + h2 + 0.75 * radius * halfLength);
187 FCL_REAL iz = (0.5 * v_cyl + 0.4 * v_sph) * radius * radius;
191 0, 0, iz).finished();
221 return boost::math::constants::pi<FCL_REAL>() * radius * radius * (halfLength * 2) / 3;
227 FCL_REAL ix = V * (0.4 * halfLength * halfLength + 3 * radius * radius / 20);
228 FCL_REAL iz = 0.3 * V * radius * radius;
232 0, 0, iz).finished();
237 return Vec3f(0, 0, -0.5 * halfLength);
265 return boost::math::constants::pi<FCL_REAL>() * radius * radius * (halfLength * 2);
271 FCL_REAL ix = V * (radius * radius / 4 + halfLength * halfLength / 3);
272 FCL_REAL iz = V * radius * radius / 2;
275 0, 0, iz).finished();
297 bool keepTriangles,
const char* qhullCommand = NULL);
316 unsigned char const&
count ()
const {
return count_; }
317 unsigned int & operator[] (
int i) { assert(i<count_);
return n_[i]; }
318 unsigned int const& operator[] (
int i)
const { assert(i<count_);
return n_[i]; }
332 neighbors(NULL), nneighbors_(NULL), own_storage_(false) {}
349 void computeCenter();
352 template <
typename PolygonT>
class Convex;
383 return std::abs(n.dot(p) - d);
430 return std::abs(n.dot(p) - d);
Vec3f c
Definition: geometric_shapes.h:82
Base for convex polytope.
Definition: geometric_shapes.h:282
Plane(FCL_REAL a, FCL_REAL b, FCL_REAL c, FCL_REAL d_)
Construct a plane with normal direction and offset.
Definition: geometric_shapes.h:415
Plane(const Vec3f &n_, FCL_REAL d_)
Construct a plane with normal direction and offset.
Definition: geometric_shapes.h:409
Eigen::Matrix< FCL_REAL, 3, 1 > Vec3f
Definition: data_types.h:67
@ GEOM_SPHERE
Definition: collision_object.h:57
FCL_REAL distance(const Vec3f &p) const
Definition: geometric_shapes.h:381
FCL_REAL signedDistance(const Vec3f &p) const
Definition: geometric_shapes.h:423
Center at zero point sphere.
Definition: geometric_shapes.h:123
FCL_REAL radius
Radius of the cylinder.
Definition: geometric_shapes.h:252
Cylinder along Z axis. The cylinder is defined at its centroid.
Definition: geometric_shapes.h:244
@ GEOM_HALFSPACE
Definition: collision_object.h:57
Center at zero point, axis aligned box.
Definition: geometric_shapes.h:87
NODE_TYPE getNodeType() const
Get node type: a conex polytope.
Definition: geometric_shapes.h:305
OBJECT_TYPE getObjectType() const
Get object type: a geometric shape.
Definition: geometric_shapes.h:62
FCL_REAL computeVolume() const
compute the volume
Definition: geometric_shapes.h:108
@ GEOM_CONVEX
Definition: collision_object.h:57
unsigned char count_
Definition: geometric_shapes.h:313
FCL_REAL computeVolume() const
compute the volume
Definition: geometric_shapes.h:174
Halfspace(const Vec3f &n_, FCL_REAL d_)
Construct a half space with normal direction and offset.
Definition: geometric_shapes.h:361
FCL_REAL radius
Radius of the cone.
Definition: geometric_shapes.h:208
Convex polytope.
Definition: convex.h:54
Halfspace()
Definition: geometric_shapes.h:372
void computeLocalAABB()
virtual function of compute AABB in local coordinate
bool own_storage_
Definition: geometric_shapes.h:346
Capsule(FCL_REAL radius_, FCL_REAL lz_)
Definition: geometric_shapes.h:157
FCL_REAL signedDistance(const Vec3f &p) const
Definition: geometric_shapes.h:376
FCL_REAL halfLength
Half Length along z axis.
Definition: geometric_shapes.h:211
Plane()
Definition: geometric_shapes.h:420
Vec3f center
center of the convex polytope, this is used for collision: center is guaranteed in the internal of th...
Definition: geometric_shapes.h:326
Neighbors * neighbors
Definition: geometric_shapes.h:323
FCL_REAL halfLength
Half Length along z axis.
Definition: geometric_shapes.h:255
Half Space: this is equivalent to the Plane in ODE. The separation plane is defined as n * x = d; Poi...
Definition: geometric_shapes.h:358
void unitNormalTest()
Turn non-unit normal into unit.
@ GEOM_CAPSULE
Definition: collision_object.h:57
unsigned int * n_
Definition: geometric_shapes.h:314
void computeLocalAABB()
Compute AABB.
NODE_TYPE
traversal node type: bounding volume (AABB, OBB, RSS, kIOS, OBBRSS, KDOP16, KDOP18,...
Definition: collision_object.h:56
Cone(FCL_REAL radius_, FCL_REAL lz_)
Definition: geometric_shapes.h:202
unsigned int * nneighbors_
Definition: geometric_shapes.h:344
@ GEOM_PLANE
Definition: collision_object.h:57
Capsule It is where is the distance between the point x and the capsule segment AB,...
Definition: geometric_shapes.h:155
Box()
Definition: geometric_shapes.h:97
Vec3f n
Plane normal.
Definition: geometric_shapes.h:393
Cone The base of the cone is at and the top is at .
Definition: geometric_shapes.h:200
int num_points
Definition: geometric_shapes.h:309
double FCL_REAL
Definition: data_types.h:66
NODE_TYPE getNodeType() const
Get node type: a plane.
Definition: geometric_shapes.h:437
@ GEOM_CONE
Definition: collision_object.h:57
OBJECT_TYPE
object type: BVH (mesh, points), basic geometry, octree
Definition: collision_object.h:53
void computeLocalAABB()
Compute AABB.
void computeLocalAABB()
Compute AABB.
void computeLocalAABB()
Compute AABB.
TriangleP(const Vec3f &a_, const Vec3f &b_, const Vec3f &c_)
Definition: geometric_shapes.h:73
unsigned char const & count() const
Definition: geometric_shapes.h:316
FCL_REAL computeVolume() const
compute the volume
Definition: geometric_shapes.h:144
Main namespace.
Definition: AABB.h:44
Matrix3f computeMomentofInertia() const
compute the inertia matrix, related to the origin
Definition: geometric_shapes.h:224
@ OT_GEOM
Definition: collision_object.h:53
FCL_REAL distance(const Vec3f &p) const
Definition: geometric_shapes.h:428
void computeLocalAABB()
Compute AABB.
virtual ~ShapeBase()
Definition: geometric_shapes.h:59
@ GEOM_CYLINDER
Definition: collision_object.h:57
Box(FCL_REAL x, FCL_REAL y, FCL_REAL z)
Definition: geometric_shapes.h:89
NODE_TYPE getNodeType() const
get the node type
Definition: geometric_shapes.h:80
Box(const Vec3f &side_)
Definition: geometric_shapes.h:93
Vec3f halfSide
box side half-length
Definition: geometric_shapes.h:100
Sphere(FCL_REAL radius_)
Definition: geometric_shapes.h:125
NODE_TYPE getNodeType() const
Get node type: a capsule.
Definition: geometric_shapes.h:172
NODE_TYPE getNodeType() const
Get node type: a cone.
Definition: geometric_shapes.h:217
void computeLocalAABB()
Compute AABB.
Eigen::Matrix< FCL_REAL, 3, 3 > Matrix3f
Definition: data_types.h:68
Vec3f * points
An array of the points of the polygon.
Definition: geometric_shapes.h:308
FCL_REAL d
Plane offset.
Definition: geometric_shapes.h:396
FCL_REAL computeVolume() const
compute the volume
Definition: geometric_shapes.h:219
Infinite plane.
Definition: geometric_shapes.h:406
The geometry for the object for collision or distance computation.
Definition: collision_object.h:64
Cylinder(FCL_REAL radius_, FCL_REAL lz_)
Definition: geometric_shapes.h:246
@ GEOM_BOX
Definition: collision_object.h:57
Vec3f n
Plane normal.
Definition: geometric_shapes.h:440
Definition: geometric_shapes.h:312
NODE_TYPE getNodeType() const
Get node type: a cylinder.
Definition: geometric_shapes.h:261
static ConvexBase * convexHull(const Vec3f *points, int num_points, bool keepTriangles, const char *qhullCommand=NULL)
Build a convex hull based on Qhull library and store the vertices and optionally the triangles.
void computeLocalAABB()
Compute AABB.
@ GEOM_TRIANGLE
Definition: collision_object.h:57
ConvexBase()
Construct an uninitialized convex object Initialization is done with ConvexBase::initialize.
Definition: geometric_shapes.h:331
NODE_TYPE getNodeType() const
Get node type: a sphere.
Definition: geometric_shapes.h:136
ConvexBase(const ConvexBase &other)
Copy constructor Only the list of neighbors is copied.
void unitNormalTest()
Turn non-unit normal into unit.
Matrix3f computeMomentofInertia() const
compute the inertia matrix, related to the origin
Definition: geometric_shapes.h:138
Matrix3f computeMomentofInertia() const
compute the inertia matrix, related to the origin
Definition: geometric_shapes.h:268
FCL_REAL radius
Radius of capsule.
Definition: geometric_shapes.h:163
Vec3f computeCOM() const
compute center of mass
Definition: geometric_shapes.h:235
NODE_TYPE getNodeType() const
Get node type: a box.
Definition: geometric_shapes.h:106
FCL_REAL halfLength
Half Length along z axis.
Definition: geometric_shapes.h:166
ShapeBase()
Definition: geometric_shapes.h:57
void initialize(bool ownStorage, Vec3f *points_, int num_points_)
Initialize the points of the convex shape This also initializes the ConvexBase::center.
Halfspace(FCL_REAL a, FCL_REAL b, FCL_REAL c, FCL_REAL d_)
Construct a plane with normal direction and offset.
Definition: geometric_shapes.h:367
FCL_REAL radius
Radius of the sphere.
Definition: geometric_shapes.h:130
Triangle stores the points instead of only indices of points.
Definition: geometric_shapes.h:71
FCL_REAL computeVolume() const
compute the volume
Definition: geometric_shapes.h:263
Base class for all basic geometric shapes.
Definition: geometric_shapes.h:55
NODE_TYPE getNodeType() const
Get node type: a half space.
Definition: geometric_shapes.h:390
Matrix3f computeMomentofInertia() const
compute the inertia matrix, related to the origin
Definition: geometric_shapes.h:179
void computeLocalAABB()
Compute AABB.
Matrix3f computeMomentofInertia() const
compute the inertia matrix, related to the origin
Definition: geometric_shapes.h:113
FCL_REAL d
Plane offset.
Definition: geometric_shapes.h:443