39 #ifndef HPP_FCL_GEOMETRIC_SHAPES_H 40 #define HPP_FCL_GEOMETRIC_SHAPES_H 42 #include <boost/math/constants/constants.hpp> 85 , a(other.a), b(other.b), c(other.c)
92 void computeLocalAABB();
98 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
115 , halfSide(other.halfSide)
128 void computeLocalAABB();
135 return 8*halfSide.prod();
141 Vec3f s (halfSide.cwiseAbs2() * V);
142 return (
Vec3f (s[1] + s[2], s[0] + s[2], s[0] + s[1]) / 3).asDiagonal();
145 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
158 , radius(other.radius)
169 void computeLocalAABB();
176 FCL_REAL I = 0.4 * radius * radius * computeVolume();
177 return I * Matrix3f::Identity();
182 return 4 * boost::math::constants::pi<FCL_REAL>() * radius * radius * radius / 3;
185 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
202 , radius(other.radius)
203 , halfLength(other.halfLength)
217 void computeLocalAABB();
224 return boost::math::constants::pi<FCL_REAL>() * radius * radius *((halfLength * 2) + radius * 4/3.0);
229 FCL_REAL v_cyl = radius * radius * (halfLength * 2) * boost::math::constants::pi<FCL_REAL>();
230 FCL_REAL v_sph = radius * radius * radius * boost::math::constants::pi<FCL_REAL>() * 4 / 3.0;
232 FCL_REAL h2 = halfLength * halfLength;
234 FCL_REAL ix = v_cyl * (h2 / 3. + r2 / 4.) + v_sph * (0.4 * r2 + h2 + 0.75 * radius * halfLength);
235 FCL_REAL iz = (0.5 * v_cyl + 0.4 * v_sph) * radius * radius;
239 0, 0, iz).finished();
242 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
259 , radius(other.radius)
260 , halfLength(other.halfLength)
265 virtual Cone* clone()
const {
return new Cone(*
this); };
274 void computeLocalAABB();
281 return boost::math::constants::pi<FCL_REAL>() * radius * radius * (halfLength * 2) / 3;
287 FCL_REAL ix = V * (0.4 * halfLength * halfLength + 3 * radius * radius / 20);
288 FCL_REAL iz = 0.3 * V * radius * radius;
292 0, 0, iz).finished();
297 return Vec3f(0, 0, -0.5 * halfLength);
300 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
315 , radius(other.radius)
316 , halfLength(other.halfLength)
330 void computeLocalAABB();
337 return boost::math::constants::pi<FCL_REAL>() * radius * radius * (halfLength * 2);
343 FCL_REAL ix = V * (radius * radius / 4 + halfLength * halfLength / 3);
344 FCL_REAL iz = V * radius * radius / 2;
347 0, 0, iz).finished();
350 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
371 bool keepTriangles,
const char* qhullCommand = NULL);
392 void computeLocalAABB();
406 unsigned char const&
count ()
const {
return count_; }
407 unsigned int & operator[] (
int i) { assert(i<count_);
return n_[i]; }
408 unsigned int const& operator[] (
int i)
const { assert(i<count_);
return n_[i]; }
422 neighbors(NULL), nneighbors_(NULL), own_storage_(false) {}
441 void computeCenter();
445 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
448 template <
typename PolygonT>
class Convex;
497 return std::abs(n.dot(p) - d);
501 void computeLocalAABB();
515 void unitNormalTest();
519 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
566 return std::abs(n.dot(p) - d);
570 void computeLocalAABB();
584 void unitNormalTest();
588 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
Definition: collision_object.h:59
Vec3f halfSide
box side half-length
Definition: geometric_shapes.h:125
NODE_TYPE getNodeType() const
Get node type: a box.
Definition: geometric_shapes.h:131
bool own_storage_
Definition: geometric_shapes.h:438
NODE_TYPE getNodeType() const
Get node type: a cone.
Definition: geometric_shapes.h:277
virtual TriangleP * clone() const
Clone *this into a new TriangleP.
Definition: geometric_shapes.h:89
Halfspace()
Definition: geometric_shapes.h:468
Vec3f n
Plane normal.
Definition: geometric_shapes.h:507
Matrix3f computeMomentofInertia() const
compute the inertia matrix, related to the origin
Definition: geometric_shapes.h:284
Vec3f computeCOM() const
compute center of mass
Definition: geometric_shapes.h:295
FCL_REAL halfLength
Half Length along z axis.
Definition: geometric_shapes.h:271
Sphere(FCL_REAL radius_)
Definition: geometric_shapes.h:152
Definition: collision_object.h:59
OBJECT_TYPE
object type: BVH (mesh, points), basic geometry, octree
Definition: collision_object.h:55
Cylinder along Z axis. The cylinder is defined at its centroid.
Definition: geometric_shapes.h:305
Main namespace.
Definition: AABB.h:43
FCL_REAL signedDistance(const Vec3f &p) const
Definition: geometric_shapes.h:490
Definition: geometric_shapes.h:401
Matrix3f computeMomentofInertia() const
compute the inertia matrix, related to the origin
Definition: geometric_shapes.h:227
Halfspace(const Vec3f &n_, FCL_REAL d_)
Construct a half space with normal direction and offset.
Definition: geometric_shapes.h:457
TriangleP(const TriangleP &other)
Definition: geometric_shapes.h:83
Capsule(const Capsule &other)
Definition: geometric_shapes.h:200
Plane(const Plane &other)
Definition: geometric_shapes.h:541
bool initialize(MeshCollisionTraversalNode< BV, RelativeTransformationIsIdentity > &node, BVHModel< BV > &model1, Transform3f &tf1, BVHModel< BV > &model2, Transform3f &tf2, CollisionResult &result, bool use_refit=false, bool refit_bottomup=false)
Initialize traversal node for collision between two meshes, given the current transforms.
Definition: traversal_node_setup.h:408
Eigen::Matrix< FCL_REAL, 3, 3 > Matrix3f
Definition: data_types.h:68
NODE_TYPE getNodeType() const
Get node type: a capsule.
Definition: geometric_shapes.h:220
Half Space: this is equivalent to the Plane in ODE. The separation plane is defined as n * x = d; Poi...
Definition: geometric_shapes.h:453
virtual ConvexBase * clone() const
.
Definition: geometric_shapes.h:376
Matrix3f computeMomentofInertia() const
compute the inertia matrix, related to the origin
Definition: geometric_shapes.h:174
FCL_REAL computeVolume() const
compute the volume
Definition: geometric_shapes.h:335
ConvexBase()
Construct an uninitialized convex object Initialization is done with ConvexBase::initialize.
Definition: geometric_shapes.h:421
Infinite plane.
Definition: geometric_shapes.h:523
Vec3f c
Definition: geometric_shapes.h:96
FCL_REAL computeVolume() const
compute the volume
Definition: geometric_shapes.h:180
virtual ~ShapeBase()
Definition: geometric_shapes.h:64
Box()
Definition: geometric_shapes.h:122
Definition: collision_object.h:59
Base class for all basic geometric shapes.
Definition: geometric_shapes.h:54
Matrix3f computeMomentofInertia() const
compute the inertia matrix, related to the origin
Definition: geometric_shapes.h:340
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:463
Definition: collision_object.h:55
virtual Box * clone() const
Clone *this into a new Box.
Definition: geometric_shapes.h:120
TriangleP(const Vec3f &a_, const Vec3f &b_, const Vec3f &c_)
Definition: geometric_shapes.h:78
ShapeBase()
Definition: geometric_shapes.h:57
FCL_REAL radius
Radius of the cone.
Definition: geometric_shapes.h:265
double FCL_REAL
Definition: data_types.h:66
FCL_REAL distance(const Vec3f &p) const
Definition: geometric_shapes.h:564
Halfspace(const Halfspace &other)
Definition: geometric_shapes.h:472
Center at zero point, axis aligned box.
Definition: geometric_shapes.h:102
Definition: collision_object.h:59
unsigned int * n_
Definition: geometric_shapes.h:404
Plane(const Vec3f &n_, FCL_REAL d_)
Construct a plane with normal direction and offset.
Definition: geometric_shapes.h:527
NODE_TYPE getNodeType() const
Get node type: a plane.
Definition: geometric_shapes.h:573
Cone(FCL_REAL radius_, FCL_REAL lz_)
Definition: geometric_shapes.h:252
Triangle stores the points instead of only indices of points.
Definition: geometric_shapes.h:75
virtual Halfspace * clone() const
Clone *this into a new Halfspace.
Definition: geometric_shapes.h:488
FCL_REAL computeVolume() const
compute the volume
Definition: geometric_shapes.h:222
virtual Plane * clone() const
Clone *this into a new Plane.
Definition: geometric_shapes.h:557
Cone The base of the cone is at and the top is at .
Definition: geometric_shapes.h:249
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:533
FCL_REAL d
Plane offset.
Definition: geometric_shapes.h:510
FCL_REAL d
Plane offset.
Definition: geometric_shapes.h:579
unsigned char count_
Definition: geometric_shapes.h:403
FCL_REAL radius
Radius of the sphere.
Definition: geometric_shapes.h:163
int num_points
Definition: geometric_shapes.h:399
Plane()
Definition: geometric_shapes.h:538
Cone(const Cone &other)
Definition: geometric_shapes.h:257
FCL_REAL radius
Radius of the cylinder.
Definition: geometric_shapes.h:321
Vec3f n
Plane normal.
Definition: geometric_shapes.h:576
Box(const Vec3f &side_)
Definition: geometric_shapes.h:109
Center at zero point sphere.
Definition: geometric_shapes.h:149
FCL_REAL computeVolume() const
compute the volume
Definition: geometric_shapes.h:279
Capsule It is where is the distance between the point x and the capsule segment AB...
Definition: geometric_shapes.h:192
Definition: collision_object.h:59
NODE_TYPE
traversal node type: bounding volume (AABB, OBB, RSS, kIOS, OBBRSS, KDOP16, KDOP18, kDOP24), basic shape (box, sphere, capsule, cone, cylinder, convex, plane, triangle), and octree
Definition: collision_object.h:58
Base for convex polytope.
Definition: geometric_shapes.h:355
FCL_REAL computeVolume() const
compute the volume
Definition: geometric_shapes.h:133
unsigned char const & count() const
Definition: geometric_shapes.h:406
Sphere(const Sphere &other)
Definition: geometric_shapes.h:156
Definition: collision_object.h:59
Cylinder(FCL_REAL radius_, FCL_REAL lz_)
Definition: geometric_shapes.h:308
NODE_TYPE getNodeType() const
Get node type: a conex polytope.
Definition: geometric_shapes.h:395
Capsule(FCL_REAL radius_, FCL_REAL lz_)
Definition: geometric_shapes.h:195
FCL_REAL signedDistance(const Vec3f &p) const
Definition: geometric_shapes.h:559
FCL_REAL halfLength
Half Length along z axis.
Definition: geometric_shapes.h:327
Box(const Box &other)
Definition: geometric_shapes.h:113
Cylinder(const Cylinder &other)
Definition: geometric_shapes.h:313
Eigen::Matrix< FCL_REAL, 3, 1 > Vec3f
Definition: data_types.h:67
Convex polytope.
Definition: convex.h:53
NODE_TYPE getNodeType() const
get the node type
Definition: geometric_shapes.h:94
The geometry for the object for collision or distance computation.
Definition: collision_object.h:65
ShapeBase(const ShapeBase &other)
.
Definition: geometric_shapes.h:60
NODE_TYPE getNodeType() const
Get node type: a half space.
Definition: geometric_shapes.h:504
Neighbors * neighbors
Definition: geometric_shapes.h:413
Definition: collision_object.h:59
Definition: collision_object.h:59
Definition: collision_object.h:59
Vec3f center
center of the convex polytope, this is used for collision: center is guaranteed in the internal of th...
Definition: geometric_shapes.h:416
FCL_REAL radius
Radius of capsule.
Definition: geometric_shapes.h:208
unsigned int * nneighbors_
Definition: geometric_shapes.h:436
FCL_REAL halfLength
Half Length along z axis.
Definition: geometric_shapes.h:214
OBJECT_TYPE getObjectType() const
Get object type: a geometric shape.
Definition: geometric_shapes.h:67
FCL_REAL distance(const Vec3f &p) const
Definition: geometric_shapes.h:495
#define HPP_FCL_DLLAPI
Definition: config.hh:64
Matrix3f computeMomentofInertia() const
compute the inertia matrix, related to the origin
Definition: geometric_shapes.h:138
NODE_TYPE getNodeType() const
Get node type: a sphere.
Definition: geometric_shapes.h:172
Vec3f * points
An array of the points of the polygon.
Definition: geometric_shapes.h:398
NODE_TYPE getNodeType() const
Get node type: a cylinder.
Definition: geometric_shapes.h:333
Box(FCL_REAL x, FCL_REAL y, FCL_REAL z)
Definition: geometric_shapes.h:105