38 #ifndef FCL_NARROWPHASE_DETAIL_INTERSECT_H 39 #define FCL_NARROWPHASE_DETAIL_INTERSECT_H 42 #include "fcl/common/types.h" 43 #include "fcl/math/geometry.h" 44 #include "fcl/math/detail/polysolver.h" 63 static bool intersect_VF(
const Vector3<S>& a0,
const Vector3<S>& b0,
const Vector3<S>& c0,
const Vector3<S>& p0,
64 const Vector3<S>& a1,
const Vector3<S>& b1,
const Vector3<S>& c1,
const Vector3<S>& p1,
65 S* collision_time, Vector3<S>* p_i,
bool useNewton =
true);
71 static bool intersect_EE(
const Vector3<S>& a0,
const Vector3<S>& b0,
const Vector3<S>& c0,
const Vector3<S>& d0,
72 const Vector3<S>& a1,
const Vector3<S>& b1,
const Vector3<S>& c1,
const Vector3<S>& d1,
73 S* collision_time, Vector3<S>* p_i,
bool useNewton =
true);
76 static bool intersect_VF_filtered(
const Vector3<S>& a0,
const Vector3<S>& b0,
const Vector3<S>& c0,
const Vector3<S>& p0,
77 const Vector3<S>& a1,
const Vector3<S>& b1,
const Vector3<S>& c1,
const Vector3<S>& p1,
78 S* collision_time, Vector3<S>* p_i,
bool useNewton =
true);
81 static bool intersect_EE_filtered(
const Vector3<S>& a0,
const Vector3<S>& b0,
const Vector3<S>& c0,
const Vector3<S>& d0,
82 const Vector3<S>& a1,
const Vector3<S>& b1,
const Vector3<S>& c1,
const Vector3<S>& d1,
83 S* collision_time, Vector3<S>* p_i,
bool useNewton =
true);
86 static bool intersect_VE(
const Vector3<S>& a0,
const Vector3<S>& b0,
const Vector3<S>& p0,
87 const Vector3<S>& a1,
const Vector3<S>& b1,
const Vector3<S>& p1,
98 Vector3<S>* contact_points =
nullptr,
99 unsigned int* num_contact_points =
nullptr,
100 S* penetration_depth =
nullptr,
101 Vector3<S>* normal =
nullptr);
105 const Vector3<S>& P1,
106 const Vector3<S>& P2,
107 const Vector3<S>& P3,
108 const Vector3<S>& Q1,
109 const Vector3<S>& Q2,
110 const Vector3<S>& Q3,
111 Vector3<S>* contact_points =
nullptr,
112 unsigned int* num_contact_points =
nullptr,
113 S* penetration_depth =
nullptr,
114 Vector3<S>* normal =
nullptr);
117 const Vector3<S>& P1,
118 const Vector3<S>& P2,
119 const Vector3<S>& P3,
120 const Vector3<S>& Q1,
121 const Vector3<S>& Q2,
122 const Vector3<S>& Q3,
125 Vector3<S>* contact_points =
nullptr,
126 unsigned int* num_contact_points =
nullptr,
127 S* penetration_depth =
nullptr,
128 Vector3<S>* normal =
nullptr);
131 const Vector3<S>& P1,
132 const Vector3<S>& P2,
133 const Vector3<S>& P3,
134 const Vector3<S>& Q1,
135 const Vector3<S>& Q2,
136 const Vector3<S>& Q3,
137 const Transform3<S>& tf,
138 Vector3<S>* contact_points =
nullptr,
139 unsigned int* num_contact_points =
nullptr,
140 S* penetration_depth =
nullptr,
141 Vector3<S>* normal =
nullptr);
146 static int project6(
const Vector3<S>& ax,
147 const Vector3<S>& p1,
const Vector3<S>& p2,
const Vector3<S>& p3,
148 const Vector3<S>& q1,
const Vector3<S>& q2,
const Vector3<S>& q3);
151 static bool isZero(S v);
154 static bool solveCubicWithIntervalNewton(
const Vector3<S>& a0,
const Vector3<S>& b0,
const Vector3<S>& c0,
const Vector3<S>& d0,
155 const Vector3<S>& va,
const Vector3<S>& vb,
const Vector3<S>& vc,
const Vector3<S>& vd,
156 S& l, S& r,
bool bVF, S coeffs[], Vector3<S>* data =
nullptr);
159 static bool insideTriangle(
const Vector3<S>& a,
const Vector3<S>& b,
const Vector3<S>& c,
const Vector3<S>&p);
162 static bool insideLineSegment(
const Vector3<S>& a,
const Vector3<S>& b,
const Vector3<S>& p);
169 static bool linelineIntersect(
const Vector3<S>& p1,
const Vector3<S>& p2,
const Vector3<S>& p3,
const Vector3<S>& p4,
170 Vector3<S>* pa, Vector3<S>* pb, S* mua, S* mub);
173 static bool checkRootValidity_VF(
const Vector3<S>& a0,
const Vector3<S>& b0,
const Vector3<S>& c0,
const Vector3<S>& p0,
174 const Vector3<S>& va,
const Vector3<S>& vb,
const Vector3<S>& vc,
const Vector3<S>& vp,
178 static bool checkRootValidity_EE(
const Vector3<S>& a0,
const Vector3<S>& b0,
const Vector3<S>& c0,
const Vector3<S>& d0,
179 const Vector3<S>& va,
const Vector3<S>& vb,
const Vector3<S>& vc,
const Vector3<S>& vd,
180 S t, Vector3<S>* q_i =
nullptr);
183 static bool checkRootValidity_VE(
const Vector3<S>& a0,
const Vector3<S>& b0,
const Vector3<S>& p0,
184 const Vector3<S>& va,
const Vector3<S>& vb,
const Vector3<S>& vp,
188 static bool solveSquare(S a, S b, S c,
189 const Vector3<S>& a0,
const Vector3<S>& b0,
const Vector3<S>& c0,
const Vector3<S>& d0,
190 const Vector3<S>& va,
const Vector3<S>& vb,
const Vector3<S>& vc,
const Vector3<S>& vd,
195 static bool solveSquare(S a, S b, S c,
196 const Vector3<S>& a0,
const Vector3<S>& b0,
const Vector3<S>& p0,
197 const Vector3<S>& va,
const Vector3<S>& vb,
const Vector3<S>& vp);
202 static void computeCubicCoeff_VF(
const Vector3<S>& a0,
const Vector3<S>& b0,
const Vector3<S>& c0,
const Vector3<S>& p0,
203 const Vector3<S>& va,
const Vector3<S>& vb,
const Vector3<S>& vc,
const Vector3<S>& vp,
204 S* a, S* b, S* c, S* d);
207 static void computeCubicCoeff_EE(
const Vector3<S>& a0,
const Vector3<S>& b0,
const Vector3<S>& c0,
const Vector3<S>& d0,
208 const Vector3<S>& va,
const Vector3<S>& vb,
const Vector3<S>& vc,
const Vector3<S>& vd,
209 S* a, S* b, S* c, S* d);
212 static void computeCubicCoeff_VE(
const Vector3<S>& a0,
const Vector3<S>& b0,
const Vector3<S>& p0,
213 const Vector3<S>& va,
const Vector3<S>& vb,
const Vector3<S>& vp,
218 static bool intersectPreFiltering(
const Vector3<S>& a0,
const Vector3<S>& b0,
const Vector3<S>& c0,
const Vector3<S>& d0,
219 const Vector3<S>& a1,
const Vector3<S>& b1,
const Vector3<S>& c1,
const Vector3<S>& d1);
222 static S distanceToPlane(
const Vector3<S>& n, S t,
const Vector3<S>& v);
225 static bool sameSideOfPlane(
const Vector3<S>& v1,
const Vector3<S>& v2,
const Vector3<S>& v3,
const Vector3<S>& n, S t);
228 static void clipTriangleByTriangleAndEdgePlanes(
const Vector3<S>& v1,
const Vector3<S>& v2,
const Vector3<S>& v3,
229 const Vector3<S>& t1,
const Vector3<S>& t2,
const Vector3<S>& t3,
230 const Vector3<S>& tn, S to,
231 Vector3<S> clipped_points[],
unsigned int* num_clipped_points,
bool clip_triangle =
false);
234 static bool buildTrianglePlane(
const Vector3<S>& v1,
const Vector3<S>& v2,
const Vector3<S>& v3, Vector3<S>* n, S* t);
237 static bool buildEdgePlane(
const Vector3<S>& v1,
const Vector3<S>& v2,
const Vector3<S>& tn, Vector3<S>* n, S* t);
240 static void computeDeepestPoints(Vector3<S>* clipped_points,
unsigned int num_clipped_points,
const Vector3<S>& n, S t, S* penetration_depth, Vector3<S>* deepest_points,
unsigned int* num_deepest_points);
243 static void clipPolygonByPlane(Vector3<S>* polygon_points,
unsigned int num_polygon_points,
const Vector3<S>& n, S t, Vector3<S> clipped_points[],
unsigned int* num_clipped_points);
246 static void clipSegmentByPlane(
const Vector3<S>& v1,
const Vector3<S>& v2,
const Vector3<S>& n, S t, Vector3<S>* clipped_point);
249 static S gaussianCDF(S x);
251 static constexpr S getEpsilon();
252 static constexpr S getNearZeroThreshold();
253 static constexpr S getCcdResolution();
254 static constexpr
unsigned int getMaxTriangleClips();
263 #include "fcl/narrowphase/detail/traversal/collision/intersect-inl.h" static bool intersect_Triangle_ODE_style(const Vector3< S > &P1, const Vector3< S > &P2, const Vector3< S > &P3, const Vector3< S > &Q1, const Vector3< S > &Q2, const Vector3< S > &Q3, Vector3< S > *contact_points=nullptr, unsigned int *num_contact_points=nullptr, S *penetration_depth=nullptr, Vector3< S > *normal=nullptr)
CD intersect between two triangles [P1, P2, P3] and [Q1, Q2, Q3].
Definition: intersect-inl.h:643
Main namespace.
Definition: broadphase_bruteforce-inl.h:45
static bool intersect_EE_filtered(const Vector3< S > &a0, const Vector3< S > &b0, const Vector3< S > &c0, const Vector3< S > &d0, const Vector3< S > &a1, const Vector3< S > &b1, const Vector3< S > &c1, const Vector3< S > &d1, S *collision_time, Vector3< S > *p_i, bool useNewton=true)
CCD intersect between two edges, using additional filter.
Definition: intersect-inl.h:584
static bool intersect_VF(const Vector3< S > &a0, const Vector3< S > &b0, const Vector3< S > &c0, const Vector3< S > &p0, const Vector3< S > &a1, const Vector3< S > &b1, const Vector3< S > &c1, const Vector3< S > &p1, S *collision_time, Vector3< S > *p_i, bool useNewton=true)
CCD intersect between one vertex and one face [a0, b0, c0] and [a1, b1, c1] are points for the triang...
Definition: intersect-inl.h:385
static bool intersect_EE(const Vector3< S > &a0, const Vector3< S > &b0, const Vector3< S > &c0, const Vector3< S > &d0, const Vector3< S > &a1, const Vector3< S > &b1, const Vector3< S > &c1, const Vector3< S > &d1, S *collision_time, Vector3< S > *p_i, bool useNewton=true)
CCD intersect between two edges [a0, b0] and [a1, b1] are points for one edge in time t0 and t1 [c0...
Definition: intersect-inl.h:451
static bool intersect_Triangle(const Vector3< S > &P1, const Vector3< S > &P2, const Vector3< S > &P3, const Vector3< S > &Q1, const Vector3< S > &Q2, const Vector3< S > &Q3, Vector3< S > *contact_points=nullptr, unsigned int *num_contact_points=nullptr, S *penetration_depth=nullptr, Vector3< S > *normal=nullptr)
CD intersect between two triangles [P1, P2, P3] and [Q1, Q2, Q3].
Definition: intersect-inl.h:728
static bool intersect_VE(const Vector3< S > &a0, const Vector3< S > &b0, const Vector3< S > &p0, const Vector3< S > &a1, const Vector3< S > &b1, const Vector3< S > &p1, const Vector3< S > &L)
CCD intersect between one vertex and and one edge.
Definition: intersect-inl.h:517
static bool intersect_VF_filtered(const Vector3< S > &a0, const Vector3< S > &b0, const Vector3< S > &c0, const Vector3< S > &p0, const Vector3< S > &a1, const Vector3< S > &b1, const Vector3< S > &c1, const Vector3< S > &p1, S *collision_time, Vector3< S > *p_i, bool useNewton=true)
CCD intersect between one vertex and one face, using additional filter.
Definition: intersect-inl.h:570
CCD intersect kernel among primitives.
Definition: intersect.h:54