45 struct CollisionRequest;
55 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
60 bool operator==(
const kIOS_Sphere& other)
const {
61 return o == other.o && r == other.r;
64 bool operator!=(
const kIOS_Sphere& other)
const {
65 return !(*
this == other);
70 static kIOS_Sphere encloseSphere(
const kIOS_Sphere& s0,
71 const kIOS_Sphere& s1) {
72 Vec3s d = s1.o - s0.o;
73 Scalar dist2 = d.squaredNorm();
74 Scalar diff_r = s1.r - s0.r;
77 if (diff_r * diff_r >= dist2) {
84 float dist = (float)std::sqrt(dist2);
86 s.r = dist + s0.r + s1.r;
88 s.o = s0.o + d * ((s.r - s0.r) / dist);
99 if (!res)
return false;
101 for (
size_t k = 0; k < num_spheres; ++k) {
102 if (spheres[k] != other.
spheres[k])
return false;
111 static constexpr
size_t max_num_spheres = 5;
114 kIOS_Sphere spheres[max_num_spheres];
130 Scalar& sqrDistLowerBound)
const;
140 *
this = *
this + other;
166 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
185 Scalar& sqrDistLowerBound);
A class describing the kIOS collision structure, which is a set of spheres.
Definition: kIOS.h:52
const Vec3s & center() const
Center of the kIOS.
Definition: kIOS.h:151
Scalar width() const
Width of the kIOS.
OBB obb
@ OBB related with kIOS
Definition: kIOS.h:120
bool contain(const Vec3s &p) const
Check whether the kIOS contains a point.
bool overlap(const kIOS &other) const
Check collision between two kIOS.
bool operator==(const kIOS &other) const
Equality operator.
Definition: kIOS.h:97
unsigned int num_spheres
The number of spheres, no larger than 5.
Definition: kIOS.h:117
bool overlap(const kIOS &other, const CollisionRequest &, Scalar &sqrDistLowerBound) const
Check collision between two kIOS.
Scalar volume() const
Volume of the kIOS.
Scalar height() const
Height of the kIOS.
Scalar depth() const
Depth of the kIOS.
Scalar size() const
size of the kIOS (used in BV_Splitter to order two kIOSs)
kIOS & operator+=(const kIOS &other)
Merge the kIOS and another kIOS.
Definition: kIOS.h:139
kIOS_Sphere spheres[max_num_spheres]
The (at most) five spheres for intersection.
Definition: kIOS.h:114
kIOS operator+(const kIOS &other) const
Return the merged kIOS of current kIOS and the other one.
bool operator!=(const kIOS &other) const
Difference operator.
Definition: kIOS.h:109
kIOS & operator+=(const Vec3s &p)
A simple way to merge the kIOS and a point.
Scalar distance(const kIOS &other, Vec3s *P=NULL, Vec3s *Q=NULL) const
The distance between two kIOS.
#define COAL_DLLAPI
Definition: config.hh:88
Main namespace.
Definition: broadphase_bruteforce.h:44
Scalar distance(const Matrix3s &R0, const Vec3s &T0, const kIOS &b1, const kIOS &b2, Vec3s *P=NULL, Vec3s *Q=NULL)
Approximate distance between two kIOS bounding volumes.
bool overlap(const Matrix3s &R0, const Vec3s &T0, const AABB &b1, const AABB &b2)
Check collision between two aabbs, b1 is in configuration (R0, T0) and b2 is in identity.
KDOP< N > translate(const KDOP< N > &bv, const Vec3s &t)
translate the KDOP BV
Eigen::Matrix< Scalar, 3, 1 > Vec3s
Definition: data_types.h:70
double Scalar
Definition: data_types.h:68
Eigen::Matrix< Scalar, 3, 3 > Matrix3s
Definition: data_types.h:74
request to the collision algorithm
Definition: collision_data.h:311
Oriented bounding box class.
Definition: OBB.h:51