48 std::vector<Vec3f> result(8);
67 std::vector<Vec3f> result(12);
69 FCL_REAL edge_size = sphere.
radius * 6 / (sqrt(27.0) + sqrt(15.0));
92 std::vector<Vec3f> result(12);
93 const FCL_REAL phi = (1 + sqrt(5.0)) / 2.0;
95 const FCL_REAL a = sqrt(3.0) / (phi * phi);
126 std::vector<Vec3f> result(36);
127 const FCL_REAL m = (1 + sqrt(5.0)) / 2.0;
130 FCL_REAL edge_size = capsule.
radius * 6 / (sqrt(27.0) + sqrt(15.0));
181 std::vector<Vec3f> result(7);
202 std::vector<Vec3f> result(12);
229 for (std::size_t i = 0; i < convex.
num_points; ++i) {
238 std::vector<Vec3f> result(3);
277 const Vec3f& T = tf.getTranslation();
279 Vec3f v_delta(R.cwiseAbs() * s.halfSide);
280 bv.max_ = T + v_delta;
281 bv.min_ = T - v_delta;
286 const Vec3f& T = tf.getTranslation();
288 Vec3f v_delta(Vec3f::Constant(s.radius));
289 bv.max_ = T + v_delta;
290 bv.min_ = T - v_delta;
297 const Vec3f& T = tf.getTranslation();
299 Vec3f v_delta = R * e.radii;
300 bv.max_ = T + v_delta;
301 bv.min_ = T - v_delta;
308 const Vec3f& T = tf.getTranslation();
310 Vec3f v_delta(R.col(2).cwiseAbs() * s.halfLength + Vec3f::Constant(s.radius));
311 bv.max_ = T + v_delta;
312 bv.min_ = T - v_delta;
318 const Vec3f& T = tf.getTranslation();
320 FCL_REAL x_range = fabs(R(0, 0) * s.radius) + fabs(R(0, 1) * s.radius) +
321 fabs(R(0, 2) * s.halfLength);
322 FCL_REAL y_range = fabs(R(1, 0) * s.radius) + fabs(R(1, 1) * s.radius) +
323 fabs(R(1, 2) * s.halfLength);
324 FCL_REAL z_range = fabs(R(2, 0) * s.radius) + fabs(R(2, 1) * s.radius) +
325 fabs(R(2, 2) * s.halfLength);
327 Vec3f v_delta(x_range, y_range, z_range);
328 bv.max_ = T + v_delta;
329 bv.min_ = T - v_delta;
336 const Vec3f& T = tf.getTranslation();
338 FCL_REAL x_range = fabs(R(0, 0) * s.radius) + fabs(R(0, 1) * s.radius) +
339 fabs(R(0, 2) * s.halfLength);
340 FCL_REAL y_range = fabs(R(1, 0) * s.radius) + fabs(R(1, 1) * s.radius) +
341 fabs(R(1, 2) * s.halfLength);
342 FCL_REAL z_range = fabs(R(2, 0) * s.radius) + fabs(R(2, 1) * s.radius) +
343 fabs(R(2, 2) * s.halfLength);
345 Vec3f v_delta(x_range, y_range, z_range);
346 bv.max_ = T + v_delta;
347 bv.min_ = T - v_delta;
354 const Vec3f& T = tf.getTranslation();
357 for (std::size_t i = 0; i < s.num_points; ++i) {
358 Vec3f new_p = R * s.points[i] + T;
368 bv =
AABB(tf.transform(s.a), tf.transform(s.b), tf.transform(s.c));
379 bv_.
min_ = Vec3f::Constant(-(std::numeric_limits<FCL_REAL>::max)());
380 bv_.
max_ = Vec3f::Constant((std::numeric_limits<FCL_REAL>::max)());
411 bv_.
min_ = Vec3f::Constant(-(std::numeric_limits<FCL_REAL>::max)());
412 bv_.
max_ = Vec3f::Constant((std::numeric_limits<FCL_REAL>::max)());
417 }
else if (n[0] > 0) {
424 }
else if (n[1] > 0) {
431 }
else if (n[2] > 0) {
442 const Vec3f& T = tf.getTranslation();
446 bv.extent = s.halfSide;
451 const Vec3f& T = tf.getTranslation();
454 bv.axes.setIdentity();
455 bv.extent.setConstant(s.radius);
461 const Vec3f& T = tf.getTranslation();
464 bv.axes.noalias() = R;
465 bv.extent << s.radius, s.radius, s.halfLength + s.radius;
471 const Vec3f& T = tf.getTranslation();
474 bv.axes.noalias() = R;
475 bv.extent << s.radius, s.radius, s.halfLength;
482 const Vec3f& T = tf.getTranslation();
485 bv.axes.noalias() = R;
486 bv.extent << s.radius, s.radius, s.halfLength;
493 const Vec3f& T = tf.getTranslation();
495 fit(s.points, s.num_points, bv);
497 bv.axes.applyOnTheLeft(R);
499 bv.To = R * bv.To + T;
505 bv.axes.setIdentity();
507 bv.extent.setConstant(((std::numeric_limits<FCL_REAL>::max)()));
513 bv.axes.setIdentity();
515 bv.length[0] = bv.length[1] = bv.radius =
516 (std::numeric_limits<FCL_REAL>::max)();
531 bv.spheres[0].o =
Vec3f();
532 bv.spheres[0].r = (std::numeric_limits<FCL_REAL>::max)();
536 void computeBV<KDOP<16>, Halfspace>(
const Halfspace& s,
const Transform3f& tf,
543 for (
short i = 0; i < D; ++i)
544 bv.dist(i) = -(std::numeric_limits<FCL_REAL>::max)();
545 for (
short i = D; i < 2 * D; ++i)
546 bv.dist(i) = (std::numeric_limits<FCL_REAL>::max)();
563 }
else if (n[2] == (
FCL_REAL)0.0 && n[0] == n[1]) {
565 bv.dist(D + 3) = n[0] * d * 2;
567 bv.dist(3) = n[0] * d * 2;
568 }
else if (n[1] == (
FCL_REAL)0.0 && n[0] == n[2]) {
570 bv.dist(D + 4) = n[0] * d * 2;
572 bv.dist(4) = n[0] * d * 2;
573 }
else if (n[0] == (
FCL_REAL)0.0 && n[1] == n[2]) {
575 bv.dist(D + 5) = n[1] * d * 2;
577 bv.dist(5) = n[1] * d * 2;
580 bv.dist(D + 6) = n[0] * d * 2;
582 bv.dist(6) = n[0] * d * 2;
585 bv.dist(D + 7) = n[0] * d * 2;
587 bv.dist(7) = n[0] * d * 2;
592 void computeBV<KDOP<18>, Halfspace>(
const Halfspace& s,
const Transform3f& tf,
600 for (
short i = 0; i < D; ++i)
601 bv.dist(i) = -(std::numeric_limits<FCL_REAL>::max)();
602 for (
short i = D; i < 2 * D; ++i)
603 bv.dist(i) = (std::numeric_limits<FCL_REAL>::max)();
620 }
else if (n[2] == (
FCL_REAL)0.0 && n[0] == n[1]) {
622 bv.dist(D + 3) = n[0] * d * 2;
624 bv.dist(3) = n[0] * d * 2;
625 }
else if (n[1] == (
FCL_REAL)0.0 && n[0] == n[2]) {
627 bv.dist(D + 4) = n[0] * d * 2;
629 bv.dist(4) = n[0] * d * 2;
630 }
else if (n[0] == (
FCL_REAL)0.0 && n[1] == n[2]) {
632 bv.dist(D + 5) = n[1] * d * 2;
634 bv.dist(5) = n[1] * d * 2;
637 bv.dist(D + 6) = n[0] * d * 2;
639 bv.dist(6) = n[0] * d * 2;
642 bv.dist(D + 7) = n[0] * d * 2;
644 bv.dist(7) = n[0] * d * 2;
647 bv.dist(D + 8) = n[1] * d * 2;
649 bv.dist(8) = n[1] * d * 2;
654 void computeBV<KDOP<24>, Halfspace>(
const Halfspace& s,
const Transform3f& tf,
662 for (
short i = 0; i < D; ++i)
663 bv.dist(i) = -(std::numeric_limits<FCL_REAL>::max)();
664 for (
short i = D; i < 2 * D; ++i)
665 bv.dist(i) = (std::numeric_limits<FCL_REAL>::max)();
682 }
else if (n[2] == (
FCL_REAL)0.0 && n[0] == n[1]) {
684 bv.dist(D + 3) = n[0] * d * 2;
686 bv.dist(3) = n[0] * d * 2;
687 }
else if (n[1] == (
FCL_REAL)0.0 && n[0] == n[2]) {
689 bv.dist(D + 4) = n[0] * d * 2;
691 bv.dist(4) = n[0] * d * 2;
692 }
else if (n[0] == (
FCL_REAL)0.0 && n[1] == n[2]) {
694 bv.dist(D + 5) = n[1] * d * 2;
696 bv.dist(5) = n[1] * d * 2;
699 bv.dist(D + 6) = n[0] * d * 2;
701 bv.dist(6) = n[0] * d * 2;
704 bv.dist(D + 7) = n[0] * d * 2;
706 bv.dist(7) = n[0] * d * 2;
709 bv.dist(D + 8) = n[1] * d * 2;
711 bv.dist(8) = n[1] * d * 2;
714 bv.dist(D + 9) = n[0] * d * 3;
716 bv.dist(9) = n[0] * d * 3;
719 bv.dist(D + 10) = n[0] * d * 3;
721 bv.dist(10) = n[0] * d * 3;
724 bv.dist(D + 11) = n[1] * d * 3;
726 bv.dist(11) = n[1] * d * 3;
732 Vec3f n = tf.getRotation() * s.n;
734 bv.axes.col(0).noalias() = n;
736 bv.extent << 0, (std::numeric_limits<FCL_REAL>::max)(),
737 (std::numeric_limits<FCL_REAL>::max)();
746 Vec3f n = tf.getRotation() * s.n;
749 bv.axes.col(0).noalias() = n;
751 bv.length[0] = (std::numeric_limits<FCL_REAL>::max)();
752 bv.length[1] = (std::numeric_limits<FCL_REAL>::max)();
757 bv.Tr = tf.transform(p);
771 bv.spheres[0].o =
Vec3f();
772 bv.spheres[0].r = (std::numeric_limits<FCL_REAL>::max)();
776 void computeBV<KDOP<16>,
Plane>(
const Plane& s,
const Transform3f& tf,
784 for (
short i = 0; i < D; ++i)
785 bv.dist(i) = -(std::numeric_limits<FCL_REAL>::max)();
786 for (
short i = D; i < 2 * D; ++i)
787 bv.dist(i) = (std::numeric_limits<FCL_REAL>::max)();
791 bv.dist(0) = bv.dist(D) = d;
793 bv.dist(0) = bv.dist(D) = -d;
796 bv.dist(1) = bv.dist(D + 1) = d;
798 bv.dist(1) = bv.dist(D + 1) = -d;
801 bv.dist(2) = bv.dist(D + 2) = d;
803 bv.dist(2) = bv.dist(D + 2) = -d;
804 }
else if (n[2] == (
FCL_REAL)0.0 && n[0] == n[1]) {
805 bv.dist(3) = bv.dist(D + 3) = n[0] * d * 2;
806 }
else if (n[1] == (
FCL_REAL)0.0 && n[0] == n[2]) {
807 bv.dist(4) = bv.dist(D + 4) = n[0] * d * 2;
808 }
else if (n[0] == (
FCL_REAL)0.0 && n[1] == n[2]) {
809 bv.dist(6) = bv.dist(D + 5) = n[1] * d * 2;
811 bv.dist(6) = bv.dist(D + 6) = n[0] * d * 2;
813 bv.dist(7) = bv.dist(D + 7) = n[0] * d * 2;
818 void computeBV<KDOP<18>,
Plane>(
const Plane& s,
const Transform3f& tf,
826 for (
short i = 0; i < D; ++i)
827 bv.dist(i) = -(std::numeric_limits<FCL_REAL>::max)();
828 for (
short i = D; i < 2 * D; ++i)
829 bv.dist(i) = (std::numeric_limits<FCL_REAL>::max)();
833 bv.dist(0) = bv.dist(D) = d;
835 bv.dist(0) = bv.dist(D) = -d;
838 bv.dist(1) = bv.dist(D + 1) = d;
840 bv.dist(1) = bv.dist(D + 1) = -d;
843 bv.dist(2) = bv.dist(D + 2) = d;
845 bv.dist(2) = bv.dist(D + 2) = -d;
846 }
else if (n[2] == (
FCL_REAL)0.0 && n[0] == n[1]) {
847 bv.dist(3) = bv.dist(D + 3) = n[0] * d * 2;
848 }
else if (n[1] == (
FCL_REAL)0.0 && n[0] == n[2]) {
849 bv.dist(4) = bv.dist(D + 4) = n[0] * d * 2;
850 }
else if (n[0] == (
FCL_REAL)0.0 && n[1] == n[2]) {
851 bv.dist(5) = bv.dist(D + 5) = n[1] * d * 2;
853 bv.dist(6) = bv.dist(D + 6) = n[0] * d * 2;
855 bv.dist(7) = bv.dist(D + 7) = n[0] * d * 2;
857 bv.dist(8) = bv.dist(D + 8) = n[1] * d * 2;
862 void computeBV<KDOP<24>,
Plane>(
const Plane& s,
const Transform3f& tf,
870 for (
short i = 0; i < D; ++i)
871 bv.dist(i) = -(std::numeric_limits<FCL_REAL>::max)();
872 for (
short i = D; i < 2 * D; ++i)
873 bv.dist(i) = (std::numeric_limits<FCL_REAL>::max)();
877 bv.dist(0) = bv.dist(D) = d;
879 bv.dist(0) = bv.dist(D) = -d;
882 bv.dist(1) = bv.dist(D + 1) = d;
884 bv.dist(1) = bv.dist(D + 1) = -d;
887 bv.dist(2) = bv.dist(D + 2) = d;
889 bv.dist(2) = bv.dist(D + 2) = -d;
890 }
else if (n[2] == (
FCL_REAL)0.0 && n[0] == n[1]) {
891 bv.dist(3) = bv.dist(D + 3) = n[0] * d * 2;
892 }
else if (n[1] == (
FCL_REAL)0.0 && n[0] == n[2]) {
893 bv.dist(4) = bv.dist(D + 4) = n[0] * d * 2;
894 }
else if (n[0] == (
FCL_REAL)0.0 && n[1] == n[2]) {
895 bv.dist(5) = bv.dist(D + 5) = n[1] * d * 2;
897 bv.dist(6) = bv.dist(D + 6) = n[0] * d * 2;
899 bv.dist(7) = bv.dist(D + 7) = n[0] * d * 2;
901 bv.dist(8) = bv.dist(D + 8) = n[1] * d * 2;
903 bv.dist(9) = bv.dist(D + 9) = n[0] * d * 3;
905 bv.dist(10) = bv.dist(D + 10) = n[0] * d * 3;
907 bv.dist(11) = bv.dist(D + 11) = n[1] * d * 3;
913 tf = Transform3f(bv.
center());
918 tf = Transform3f(bv.
axes, bv.
To);
933 tf = Transform3f(bv.
axes, bv.
Tr);
938 tf = Transform3f(bv.
center());
943 tf = Transform3f(bv.
center());
948 tf = Transform3f(bv.
center());
954 tf = tf_bv * Transform3f(bv.
center());
960 tf = tf_bv * Transform3f(bv.
axes, bv.
To);
978 tf = tf_bv * Transform3f(bv.
axes, bv.
Tr);
984 tf = tf_bv * Transform3f(bv.
center());
990 tf = tf_bv * Transform3f(bv.
center());
996 tf = tf_bv * Transform3f(bv.
center());
FCL_REAL depth() const
Depth of the RSS.
Vec3f halfSide
box side half-length
HPP_FCL_DLLAPI void computeBV< OBB, Halfspace >(const Halfspace &s, const Transform3f &tf, OBB &bv)
HPP_FCL_DLLAPI void computeBV< OBB, ConvexBase >(const ConvexBase &s, const Transform3f &tf, OBB &bv)
OBB obb
OBB member, for rotation.
void generateCoordinateSystem(const Eigen::MatrixBase< Derived1 > &_w, const Eigen::MatrixBase< Derived2 > &_u, const Eigen::MatrixBase< Derived3 > &_v)
HPP_FCL_DLLAPI void computeBV< AABB, Capsule >(const Capsule &s, const Transform3f &tf, AABB &bv)
Vec3f min_
The min point in the AABB.
KDOP class describes the KDOP collision structures. K is set as the template parameter, which should be 16, 18, or 24 The KDOP structure is defined by some pairs of parallel planes defined by some axes. For K = 16, the planes are 6 AABB planes and 10 diagonal planes that cut off some space of the edges: (-1,0,0) and (1,0,0) -> indices 0 and 8 (0,-1,0) and (0,1,0) -> indices 1 and 9 (0,0,-1) and (0,0,1) -> indices 2 and 10 (-1,-1,0) and (1,1,0) -> indices 3 and 11 (-1,0,-1) and (1,0,1) -> indices 4 and 12 (0,-1,-1) and (0,1,1) -> indices 5 and 13 (-1,1,0) and (1,-1,0) -> indices 6 and 14 (-1,0,1) and (1,0,-1) -> indices 7 and 15 For K = 18, the planes are 6 AABB planes and 12 diagonal planes that cut off some space of the edges: (-1,0,0) and (1,0,0) -> indices 0 and 9 (0,-1,0) and (0,1,0) -> indices 1 and 10 (0,0,-1) and (0,0,1) -> indices 2 and 11 (-1,-1,0) and (1,1,0) -> indices 3 and 12 (-1,0,-1) and (1,0,1) -> indices 4 and 13 (0,-1,-1) and (0,1,1) -> indices 5 and 14 (-1,1,0) and (1,-1,0) -> indices 6 and 15 (-1,0,1) and (1,0,-1) -> indices 7 and 16 (0,-1,1) and (0,1,-1) -> indices 8 and 17 For K = 18, the planes are 6 AABB planes and 18 diagonal planes that cut off some space of the edges: (-1,0,0) and (1,0,0) -> indices 0 and 12 (0,-1,0) and (0,1,0) -> indices 1 and 13 (0,0,-1) and (0,0,1) -> indices 2 and 14 (-1,-1,0) and (1,1,0) -> indices 3 and 15 (-1,0,-1) and (1,0,1) -> indices 4 and 16 (0,-1,-1) and (0,1,1) -> indices 5 and 17 (-1,1,0) and (1,-1,0) -> indices 6 and 18 (-1,0,1) and (1,0,-1) -> indices 7 and 19 (0,-1,1) and (0,1,-1) -> indices 8 and 20 (-1, -1, 1) and (1, 1, -1) –> indices 9 and 21 (-1, 1, -1) and (1, -1, 1) –> indices 10 and 22 (1, -1, -1) and (-1, 1, 1) –> indices 11 and 23.
Ellipsoid centered at point zero.
HPP_FCL_DLLAPI void computeBV< AABB, Cone >(const Cone &s, const Transform3f &tf, AABB &bv)
Vec3f center() const
Center of the AABB.
FCL_REAL halfLength
Half Length along z axis.
Cylinder along Z axis. The cylinder is defined at its centroid.
HPP_FCL_DLLAPI void computeBV< OBB, Capsule >(const Capsule &s, const Transform3f &tf, OBB &bv)
HPP_FCL_DLLAPI void computeBV< OBB, Cone >(const Cone &s, const Transform3f &tf, OBB &bv)
HPP_FCL_DLLAPI void computeBV< OBB, Box >(const Box &s, const Transform3f &tf, OBB &bv)
Matrix3f axes
Orientation of RSS. axis[i] is the ith column of the orientation matrix for the RSS; it is also the i...
Eigen::Matrix< FCL_REAL, 3, 3 > Matrix3f
HPP_FCL_DLLAPI void computeBV< AABB, Sphere >(const Sphere &s, const Transform3f &tf, AABB &bv)
Half Space: this is equivalent to the Plane in ODE. The separation plane is defined as n * x = d; Poi...
std::vector< Vec3f > getBoundVertices(const Box &box, const Transform3f &tf)
HPP_FCL_DLLAPI void computeBV< AABB, Plane >(const Plane &s, const Transform3f &tf, AABB &bv)
HPP_FCL_DLLAPI void computeBV< OBB, Plane >(const Plane &s, const Transform3f &tf, OBB &bv)
FCL_REAL depth() const
The (AABB) depth.
OBB obb
@ OBB related with kIOS
HPP_FCL_DLLAPI void computeBV< kIOS, Plane >(const Plane &s, const Transform3f &tf, kIOS &bv)
FCL_REAL height() const
Height of the RSS.
A class describing the kIOS collision structure, which is a set of spheres.
HPP_FCL_DLLAPI void computeBV< AABB, Cylinder >(const Cylinder &s, const Transform3f &tf, AABB &bv)
void fit(Vec3f *ps, unsigned int n, BV &bv)
Compute a bounding volume that fits a set of n points.
HPP_FCL_DLLAPI void computeBV< AABB, Ellipsoid >(const Ellipsoid &e, const Transform3f &tf, AABB &bv)
FCL_REAL radius
Radius of the cone.
HPP_FCL_DLLAPI void computeBV< AABB, Box >(const Box &s, const Transform3f &tf, AABB &bv)
HPP_FCL_DLLAPI void computeBV< AABB, TriangleP >(const TriangleP &s, const Transform3f &tf, AABB &bv)
Vec3f Tr
Origin of the rectangle in RSS.
Center at zero point, axis aligned box.
HPP_FCL_DLLAPI void computeBV< AABB, Halfspace >(const Halfspace &s, const Transform3f &tf, AABB &bv)
FCL_REAL height() const
The (AABB) height.
Triangle stores the points instead of only indices of points.
HPP_FCL_DLLAPI void computeBV< OBBRSS, Halfspace >(const Halfspace &s, const Transform3f &tf, OBBRSS &bv)
HPP_FCL_DLLAPI void computeBV< kIOS, Halfspace >(const Halfspace &s, const Transform3f &tf, kIOS &bv)
Cone The base of the cone is at and the top is at .
A class describing the AABB collision structure, which is a box in 3D space determined by two diagona...
Vec3f max_
The max point in the AABB.
FCL_REAL radius
Radius of the sphere.
FCL_REAL radius
Radius of the cylinder.
Center at zero point sphere.
Capsule It is where is the distance between the point x and the capsule segment AB...
Base for convex polytope.
Vec3f center() const
The (AABB) center.
FCL_REAL width() const
Width of the RSS.
HPP_FCL_DLLAPI void computeBV< RSS, Halfspace >(const Halfspace &s, const Transform3f &tf, RSS &bv)
HPP_FCL_DLLAPI void computeBV< OBB, Cylinder >(const Cylinder &s, const Transform3f &tf, OBB &bv)
HPP_FCL_DLLAPI void computeBV< OBB, Sphere >(const Sphere &s, const Transform3f &tf, OBB &bv)
FCL_REAL halfLength
Half Length along z axis.
Eigen::Matrix< FCL_REAL, 3, 1 > Vec3f
Vec3f radii
Radii of the Ellipsoid (such that on boundary: x^2/rx^2 + y^2/ry^2.
HPP_FCL_DLLAPI void constructBox(const AABB &bv, Box &box, Transform3f &tf)
construct a box shape (with a configuration) from a given bounding volume
HPP_FCL_DLLAPI void computeBV< OBBRSS, Plane >(const Plane &s, const Transform3f &tf, OBBRSS &bv)
HPP_FCL_DLLAPI void computeBV< AABB, ConvexBase >(const ConvexBase &s, const Transform3f &tf, AABB &bv)
Matrix3f axes
Orientation of OBB. axis[i] is the ith column of the orientation matrix for the box; it is also the i...
HPP_FCL_DLLAPI Halfspace transform(const Halfspace &a, const Transform3f &tf)
FCL_REAL width() const
The (AABB) width.
HPP_FCL_DLLAPI void computeBV< RSS, Plane >(const Plane &s, const Transform3f &tf, RSS &bv)
FCL_REAL radius
Radius of capsule.
FCL_REAL halfLength
Half Length along z axis.
Vec3f extent
Half dimensions of OBB.
Vec3f * points
An array of the points of the polygon.
Oriented bounding box class.