Plasma Engine  2.0
Loading...
Searching...
No Matches
Plane_inl.h
1#pragma once
2
3#include <Foundation/Math/Mat4.h>
4
5template <typename Type>
7{
8#if PL_ENABLED(PL_MATH_CHECK_FOR_NAN)
9 // Initialize all data to NaN in debug mode to find problems with uninitialized data easier.
10 const Type TypeNaN = plMath::NaN<Type>();
11 m_vNormal.Set(TypeNaN);
12 m_fNegDistance = TypeNaN;
13#endif
14}
15
16template <typename Type>
18{
20 res.m_vNormal.Set(0);
21 res.m_fNegDistance = 0;
22 return res;
23}
24
25template <typename Type>
27{
28 PL_ASSERT_DEV(vNormal.IsNormalized(), "Normal must be normalized.");
29
31 res.m_vNormal = vNormal;
32 res.m_fNegDistance = -vNormal.Dot(vPointOnPlane);
33 return res;
34}
35
36template <typename Type>
38{
40 PL_VERIFY(res.m_vNormal.CalculateNormal(v1, v2, v3).Succeeded(), "The 3 provided points do not form a plane");
41
42 res.m_fNegDistance = -res.m_vNormal.Dot(v1);
43 return res;
44}
46template <typename Type>
48{
49 return plVec4(m_vNormal.x, m_vNormal.y, m_vNormal.z, m_fNegDistance);
50}
51
52template <typename Type>
54{
55 if (m_vNormal.CalculateNormal(v1, v2, v3) == PL_FAILURE)
56 return PL_FAILURE;
57
58 m_fNegDistance = -m_vNormal.Dot(v1);
59 return PL_SUCCESS;
60}
61
62template <typename Type>
64{
65 if (m_vNormal.CalculateNormal(pVertices[0], pVertices[1], pVertices[2]) == PL_FAILURE)
66 return PL_FAILURE;
67
68 m_fNegDistance = -m_vNormal.Dot(pVertices[0]);
69 return PL_SUCCESS;
70}
71
72template <typename Type>
74{
75 plVec3Template<Type> vNormal = vTangent1.CrossRH(vTangent2);
77
78 m_vNormal = vNormal;
79 m_fNegDistance = -vNormal.Dot(vPointOnPlane);
80 return res;
82
83template <typename Type>
85{
86 plVec3Template<Type> vPointOnPlane = m_vNormal * -m_fNegDistance;
88 // Transform the normal
89 plVec3Template<Type> vTransformedNormal = m.TransformDirection(m_vNormal);
90
91 // Normalize the normal vector
92 const bool normalizeSucceeded = vTransformedNormal.NormalizeIfNotZero().Succeeded();
93 PL_ASSERT_DEBUG(normalizeSucceeded, "");
94 PL_IGNORE_UNUSED(normalizeSucceeded);
95
96 // If the plane's distance is already infinite, there won't be any meaningful change
97 // to it as a result of the transformation.
98 if (!plMath::IsFinite(m_fNegDistance))
99 {
100 m_vNormal = vTransformedNormal;
101 }
102 else
103 {
104 *this = plPlane::MakeFromNormalAndPoint(vTransformedNormal, m * vPointOnPlane);
106}
107
108template <typename Type>
110{
111 plVec3Template<Type> vPointOnPlane = m_vNormal * -m_fNegDistance;
112
113 // Transform the normal
114 plVec3Template<Type> vTransformedNormal = m.TransformDirection(m_vNormal);
115
116 // Normalize the normal vector
117 const bool normalizeSucceeded = vTransformedNormal.NormalizeIfNotZero().Succeeded();
118 PL_ASSERT_DEBUG(normalizeSucceeded, "");
119 PL_IGNORE_UNUSED(normalizeSucceeded);
121 // If the plane's distance is already infinite, there won't be any meaningful change
122 // to it as a result of the transformation.
123 if (!plMath::IsFinite(m_fNegDistance))
124 {
125 m_vNormal = vTransformedNormal;
127 else
128 {
129 *this = plPlane::MakeFromNormalAndPoint(vTransformedNormal, m * vPointOnPlane);
130 }
132
133template <typename Type>
134PL_FORCE_INLINE void plPlaneTemplate<Type>::Flip()
135{
136 m_fNegDistance = -m_fNegDistance;
137 m_vNormal = -m_vNormal;
138}
139
140template <typename Type>
141PL_FORCE_INLINE Type plPlaneTemplate<Type>::GetDistanceTo(const plVec3Template<Type>& vPoint) const
142{
143 return (m_vNormal.Dot(vPoint) + m_fNegDistance);
144}
145
146template <typename Type>
149 return (m_vNormal.Dot(vPoint) < -m_fNegDistance ? plPositionOnPlane::Back : plPositionOnPlane::Front);
150}
152template <typename Type>
155 const Type f = m_vNormal.Dot(vPoint);
156
157 if (f + fPlaneHalfWidth < -m_fNegDistance)
159
160 if (f - fPlaneHalfWidth > -m_fNegDistance)
162
164}
165
166template <typename Type>
168{
169 return vPoint - m_vNormal * (m_vNormal.Dot(vPoint) + m_fNegDistance);
170}
171
172template <typename Type>
174{
175 return vPoint - (Type)2 * GetDistanceTo(vPoint) * m_vNormal;
176}
178template <typename Type>
181 plVec3Template<Type> res = vDirection;
182 res.MakeOrthogonalTo(m_vNormal);
183 return res;
184}
186template <typename Type>
188{
189 return m_vNormal.IsIdentical(rhs.m_vNormal) && m_fNegDistance == rhs.m_fNegDistance;
190}
191
192template <typename Type>
193bool plPlaneTemplate<Type>::IsEqual(const plPlaneTemplate& rhs, Type fEpsilon) const
194{
195 return m_vNormal.IsEqual(rhs.m_vNormal, fEpsilon) && plMath::IsEqual(m_fNegDistance, rhs.m_fNegDistance, fEpsilon);
196}
197
198template <typename Type>
199PL_ALWAYS_INLINE bool operator==(const plPlaneTemplate<Type>& lhs, const plPlaneTemplate<Type>& rhs)
200{
201 return lhs.IsIdentical(rhs);
202}
203
204template <typename Type>
205PL_ALWAYS_INLINE bool operator!=(const plPlaneTemplate<Type>& lhs, const plPlaneTemplate<Type>& rhs)
206{
207 return !lhs.IsIdentical(rhs);
208}
209
210template <typename Type>
211bool plPlaneTemplate<Type>::FlipIfNecessary(const plVec3Template<Type>& vPoint, bool bPlaneShouldFacePoint)
212{
213 if ((GetPointPosition(vPoint) == plPositionOnPlane::Front) != bPlaneShouldFacePoint)
214 {
215 Flip();
216 return true;
217 }
218
219 return false;
220}
221
222template <typename Type>
224{
225 return !IsNaN() && m_vNormal.IsNormalized(plMath::DefaultEpsilon<Type>());
226}
227
228template <typename Type>
230{
231 return plMath::IsNaN(m_fNegDistance) || m_vNormal.IsNaN();
232}
233
234template <typename Type>
236{
237 return m_vNormal.IsValid() && plMath::IsFinite(m_fNegDistance);
238}
239
243template <typename Type>
244plResult plPlaneTemplate<Type>::SetFromPoints(const plVec3Template<Type>* const pVertices, plUInt32 uiMaxVertices)
245{
246 plInt32 iPoints[3];
247
248 if (FindSupportPoints(pVertices, uiMaxVertices, iPoints[0], iPoints[1], iPoints[2]) == PL_FAILURE)
249 {
250 SetFromPoints(pVertices).IgnoreResult();
251 return PL_FAILURE;
252 }
253
254 SetFromPoints(pVertices[iPoints[0]], pVertices[iPoints[1]], pVertices[iPoints[2]]).IgnoreResult();
255 return PL_SUCCESS;
256}
257
258template <typename Type>
259plResult plPlaneTemplate<Type>::FindSupportPoints(const plVec3Template<Type>* const pVertices, int iMaxVertices, int& out_i1, int& out_i2, int& out_i3)
260{
261 const plVec3Template<Type> v1 = pVertices[0];
262
263 bool bFoundSecond = false;
264
265 int i = 1;
266 while (i < iMaxVertices)
267 {
268 if (pVertices[i].IsEqual(v1, 0.001f) == false)
269 {
270 bFoundSecond = true;
271 break;
272 }
273
274 ++i;
275 }
276
277 if (!bFoundSecond)
278 return PL_FAILURE;
279
280 const plVec3Template<Type> v2 = pVertices[i];
281
282 const plVec3Template<Type> vDir1 = (v1 - v2).GetNormalized();
283
284 out_i1 = 0;
285 out_i2 = i;
286
287 ++i;
288
289 while (i < iMaxVertices)
290 {
291 // check for inequality, then for non-collinearity
292 if ((pVertices[i].IsEqual(v2, 0.001f) == false) && (plMath::Abs((pVertices[i] - v2).GetNormalized().Dot(vDir1)) < (Type)0.999))
293 {
294 out_i3 = i;
295 return PL_SUCCESS;
296 }
297
298 ++i;
299 }
300
301 return PL_FAILURE;
302}
303
304template <typename Type>
306{
307 bool bFront = false;
308 bool bBack = false;
309
310 for (plUInt32 i = 0; i < uiVertices; ++i)
311 {
312 switch (GetPointPosition(pPoints[i]))
313 {
315 if (bBack)
317 bFront = true;
318 break;
320 if (bFront)
322 bBack = true;
323 break;
324
325 default:
326 break;
327 }
328 }
329
331}
332
333template <typename Type>
334plPositionOnPlane::Enum plPlaneTemplate<Type>::GetObjectPosition(const plVec3Template<Type>* const pPoints, plUInt32 uiVertices, Type fPlaneHalfWidth) const
335{
336 bool bFront = false;
337 bool bBack = false;
338
339 for (plUInt32 i = 0; i < uiVertices; ++i)
340 {
341 switch (GetPointPosition(pPoints[i], fPlaneHalfWidth))
342 {
344 if (bBack)
346 bFront = true;
347 break;
349 if (bFront)
351 bBack = true;
352 break;
353
354 default:
355 break;
356 }
357 }
358
359 if (bFront)
361 if (bBack)
363
365}
366
367template <typename Type>
368bool plPlaneTemplate<Type>::GetRayIntersection(const plVec3Template<Type>& vRayStartPos, const plVec3Template<Type>& vRayDir, Type* out_pIntersectionDistance, plVec3Template<Type>* out_pIntersection) const
369{
370 PL_ASSERT_DEBUG(vRayStartPos.IsValid(), "Ray start position must be valid.");
371 PL_ASSERT_DEBUG(vRayDir.IsValid(), "Ray direction must be valid.");
372
373 const Type fPlaneSide = GetDistanceTo(vRayStartPos);
374 const Type fCosAlpha = m_vNormal.Dot(vRayDir);
375
376 if (fCosAlpha == 0) // ray is orthogonal to plane
377 return false;
378
379 if (plMath::Sign(fPlaneSide) == plMath::Sign(fCosAlpha)) // ray points away from the plane
380 return false;
381
382 const Type fTime = -fPlaneSide / fCosAlpha;
383
384 if (out_pIntersectionDistance)
385 *out_pIntersectionDistance = fTime;
386
387 if (out_pIntersection)
388 *out_pIntersection = vRayStartPos + fTime * vRayDir;
389
390 return true;
391}
392
393template <typename Type>
394bool plPlaneTemplate<Type>::GetRayIntersectionBiDirectional(const plVec3Template<Type>& vRayStartPos, const plVec3Template<Type>& vRayDir, Type* out_pIntersectionDistance, plVec3Template<Type>* out_pIntersection) const
395{
396 PL_ASSERT_DEBUG(vRayStartPos.IsValid(), "Ray start position must be valid.");
397 PL_ASSERT_DEBUG(vRayDir.IsValid(), "Ray direction must be valid.");
398
399 const Type fPlaneSide = GetDistanceTo(vRayStartPos);
400 const Type fCosAlpha = m_vNormal.Dot(vRayDir);
401
402 if (fCosAlpha == 0) // ray is orthogonal to plane
403 return false;
404
405 const Type fTime = -fPlaneSide / fCosAlpha;
406
407 if (out_pIntersectionDistance)
408 *out_pIntersectionDistance = fTime;
409
410 if (out_pIntersection)
411 *out_pIntersection = vRayStartPos + fTime * vRayDir;
412
413 return true;
414}
415
416template <typename Type>
417bool plPlaneTemplate<Type>::GetLineSegmentIntersection(const plVec3Template<Type>& vLineStartPos, const plVec3Template<Type>& vLineEndPos, Type* out_pHitFraction, plVec3Template<Type>* out_pIntersection) const
418{
419 Type fTime = 0;
420
421 if (!GetRayIntersection(vLineStartPos, vLineEndPos - vLineStartPos, &fTime, out_pIntersection))
422 return false;
423
424 if (out_pHitFraction)
425 *out_pHitFraction = fTime;
426
427 return (fTime <= 1);
428}
429
430template <typename Type>
431Type plPlaneTemplate<Type>::GetMinimumDistanceTo(const plVec3Template<Type>* pPoints, plUInt32 uiNumPoints, plUInt32 uiStride /* = sizeof (plVec3Template<Type>) */) const
432{
433 PL_ASSERT_DEBUG(pPoints != nullptr, "Array may not be nullptr.");
434 PL_ASSERT_DEBUG(uiStride >= sizeof(plVec3Template<Type>), "Stride must be at least sizeof(plVec3Template) to not have overlapping data.");
435 PL_ASSERT_DEBUG(uiNumPoints >= 1, "Array must contain at least one point.");
436
437 Type fMinDist = plMath::MaxValue<Type>();
438
439 const plVec3Template<Type>* pCurPoint = pPoints;
440
441 for (plUInt32 i = 0; i < uiNumPoints; ++i)
442 {
443 fMinDist = plMath::Min(m_vNormal.Dot(*pCurPoint), fMinDist);
444
445 pCurPoint = plMemoryUtils::AddByteOffset(pCurPoint, uiStride);
446 }
447
448 return fMinDist + m_fNegDistance;
449}
450
451template <typename Type>
452void plPlaneTemplate<Type>::GetMinMaxDistanceTo(Type& out_fMin, Type& out_fMax, const plVec3Template<Type>* pPoints, plUInt32 uiNumPoints, plUInt32 uiStride /* = sizeof (plVec3Template<Type>) */) const
453{
454 PL_ASSERT_DEBUG(pPoints != nullptr, "Array may not be nullptr.");
455 PL_ASSERT_DEBUG(uiStride >= sizeof(plVec3Template<Type>), "Stride must be at least sizeof(plVec3Template) to not have overlapping data.");
456 PL_ASSERT_DEBUG(uiNumPoints >= 1, "Array must contain at least one point.");
457
458 out_fMin = plMath::MaxValue<Type>();
459 out_fMax = -plMath::MaxValue<Type>();
460
461 const plVec3Template<Type>* pCurPoint = pPoints;
462
463 for (plUInt32 i = 0; i < uiNumPoints; ++i)
464 {
465 const Type f = m_vNormal.Dot(*pCurPoint);
466
467 out_fMin = plMath::Min(f, out_fMin);
468 out_fMax = plMath::Max(f, out_fMax);
469
470 pCurPoint = plMemoryUtils::AddByteOffset(pCurPoint, uiStride);
471 }
472
473 out_fMin += m_fNegDistance;
474 out_fMax += m_fNegDistance;
475}
476
477template <typename Type>
479{
480 const plVec3Template<Type> n1(p0.m_vNormal);
481 const plVec3Template<Type> n2(p1.m_vNormal);
482 const plVec3Template<Type> n3(p2.m_vNormal);
483
484 const Type det = n1.Dot(n2.CrossRH(n3));
485
486 if (plMath::IsZero<Type>(det, plMath::LargeEpsilon<Type>()))
487 return PL_FAILURE;
488
489 out_vResult = (-p0.m_fNegDistance * n2.CrossRH(n3) + -p1.m_fNegDistance * n3.CrossRH(n1) + -p2.m_fNegDistance * n1.CrossRH(n2)) / det;
490
491 return PL_SUCCESS;
492}
493
494#include <Foundation/Math/Implementation/AllClasses_inl.h>
A 3x3 component matrix class.
Definition Mat3.h:9
const plVec3Template< Type > TransformDirection(const plVec3Template< Type > &v) const
Matrix-vector multiplication, assuming the 4th component of the vector is zero. So,...
Definition Mat3_inl.h:244
A 4x4 component matrix class.
Definition Mat4.h:11
const plVec3Template< Type > TransformDirection(const plVec3Template< Type > &v) const
Matrix-vector multiplication, assuming the 4th component of the vector is zero. So,...
Definition Mat4_inl.h:374
static T * AddByteOffset(T *pPtr, std::ptrdiff_t offset)
Returns the address stored in ptr plus the given byte offset iOffset, cast to type T.
A 3-component vector class.
Definition Vec3.h:9
const plVec3Template< Type > CrossRH(const plVec3Template< Type > &rhs) const
Returns the Cross-product of the two vectors (NOT commutative, order DOES matter)
Definition Vec3_inl.h:299
bool IsIdentical(const plVec3Template< Type > &rhs) const
Equality Check (bitwise)
Definition Vec3_inl.h:422
bool IsValid() const
Checks that all components are finite numbers.
Definition Vec3_inl.h:157
PL_DECLARE_IF_FLOAT_TYPE bool IsNormalized(Type fEpsilon=plMath::HugeEpsilon< Type >()) const
Returns, whether the squared length of this vector is between 0.999f and 1.001f.
Definition Vec3_inl.h:121
PL_DECLARE_IF_FLOAT_TYPE plResult NormalizeIfNotZero(const plVec3Template< Type > &vFallback=plVec3Template< Type >(1, 0, 0), Type fEpsilon=plMath::SmallEpsilon< Type >())
Tries to normalize this vector. If the vector is too close to zero, PL_FAILURE is returned and the ve...
Definition Vec3_inl.h:101
Type Dot(const plVec3Template< Type > &rhs) const
Returns the Dot-product of the two vectors (commutative, order does not matter)
Definition Vec3_inl.h:290
PL_DECLARE_IF_FLOAT_TYPE void MakeOrthogonalTo(const plVec3Template< Type > &vNormal)
Modifies this direction vector to be orthogonal to the given (normalized) direction vector....
Definition Vec3_inl.h:260
A 4-component vector class.
Definition Vec4.h:9
constexpr PL_ALWAYS_INLINE T Min(T f1, T f2)
Returns the smaller value, f1 or f2.
Definition Math_inl.h:27
constexpr TYPE MaxValue()
Returns the largest possible positive value (that is not infinity).
constexpr TYPE NaN()
Returns the value for NaN as the template type. Returns zero, if the type does not support NaN.
Definition Constants_inl.h:58
constexpr PL_ALWAYS_INLINE T Sign(T f)
Returns the sign of f (i.e: -1, 1 or 0)
Definition Math_inl.h:14
bool IsZero(Type f, Type fEpsilon)
Checks whether the given number is close to zero.
Definition Math_inl.h:288
constexpr bool IsEqual(Type lhs, Type rhs, Type fEpsilon)
Checks, whether fValue is in the range [fDesired - fMaxImprecision; fDesired + fMaxImprecision].
Definition Math_inl.h:276
constexpr PL_ALWAYS_INLINE T Abs(T f)
Returns the absolute value of f.
Definition Math_inl.h:21
constexpr PL_ALWAYS_INLINE T Max(T f1, T f2)
Returns the greater value, f1 or f2.
Definition Math_inl.h:39
A class that represents a mathematical plane.
Definition Plane.h:21
bool IsValid() const
Checks whether the plane has valid values (not NaN, normalized normal).
Definition Plane_inl.h:223
static plPlaneTemplate< Type > MakeInvalid()
Returns an invalid plane with a zero normal.
Definition Plane_inl.h:17
static plPlaneTemplate< Type > MakeFromNormalAndPoint(const plVec3Template< Type > &vNormal, const plVec3Template< Type > &vPointOnPlane)
Creates a plane from a normal and a point on the plane.
Definition Plane_inl.h:26
bool IsNaN() const
Checks whether any component is NaN.
Definition Plane_inl.h:229
bool GetRayIntersection(const plVec3Template< Type > &vRayStartPos, const plVec3Template< Type > &vRayDir, Type *out_pIntersectionDinstance=nullptr, plVec3Template< Type > *out_pIntersection=nullptr) const
Returns true, if the ray hit the plane. The intersection time describes at which multiple of the ray ...
Definition Plane_inl.h:368
const plVec3Template< Type > Mirror(const plVec3Template< Type > &vPoint) const
Returns the mirrored point. E.g. on the other side of the plane, at the same distance.
Definition Plane_inl.h:173
const plVec3Template< Type > GetCoplanarDirection(const plVec3Template< Type > &vDirection) const
Take the given direction vector and returns a modified one that is coplanar to the plane.
Definition Plane_inl.h:179
bool FlipIfNecessary(const plVec3Template< Type > &vPoint, bool bPlaneShouldFacePoint=true)
Negates Normal/Distance to switch which side of the plane is front and back. Returns true,...
Definition Plane_inl.h:211
plPositionOnPlane::Enum GetObjectPosition(const plVec3Template< Type > *const pPoints, plUInt32 uiVertices) const
Returns on which side of the plane the set of points lies. Might be on both sides.
Definition Plane_inl.h:305
plResult SetFromDirections(const plVec3Template< Type > &vTangent1, const plVec3Template< Type > &vTangent2, const plVec3Template< Type > &vPointOnPlane)
Creates a plane from two direction vectors that span the plane, and one point on it.
Definition Plane_inl.h:73
Type GetDistanceTo(const plVec3Template< Type > &vPoint) const
Returns the distance of the point to the plane.
Definition Plane_inl.h:141
bool GetLineSegmentIntersection(const plVec3Template< Type > &vLineStartPos, const plVec3Template< Type > &vLineEndPos, Type *out_pHitFraction=nullptr, plVec3Template< Type > *out_pIntersection=nullptr) const
Returns true, if there is any intersection with the plane between the line's start and end position....
Definition Plane_inl.h:417
plResult SetFromPoints(const plVec3Template< Type > &v1, const plVec3Template< Type > &v2, const plVec3Template< Type > &v3)
Creates the plane-equation from three points on the plane.
Definition Plane_inl.h:53
static plResult FindSupportPoints(const plVec3Template< Type > *const pVertices, plInt32 iMaxVertices, plInt32 &out_i1, plInt32 &out_i2, plInt32 &out_i3)
Returns three points from an unreliable set of points, that reliably form a plane....
Definition Plane_inl.h:259
bool IsIdentical(const plPlaneTemplate< Type > &rhs) const
Checks whether this plane and the other are identical.
Definition Plane_inl.h:187
static plResult GetPlanesIntersectionPoint(const plPlaneTemplate< Type > &p0, const plPlaneTemplate< Type > &p1, const plPlaneTemplate< Type > &p2, plVec3Template< Type > &out_vResult)
Computes the one point where all three planes intersect. Returns PL_FAILURE if no such point exists.
Definition Plane_inl.h:478
static plPlaneTemplate< Type > MakeFromPoints(const plVec3Template< Type > &v1, const plVec3Template< Type > &v2, const plVec3Template< Type > &v3)
Creates a plane from three points.
Definition Plane_inl.h:37
void GetMinMaxDistanceTo(Type &out_fMin, Type &out_fMax, const plVec3Template< Type > *pPoints, plUInt32 uiNumPoints, plUInt32 uiStride=sizeof(plVec3Template< Type >)) const
Returns the minimum and maximum distance that any of the given points had to the plane.
Definition Plane_inl.h:452
plPlaneTemplate()
Default constructor. Does not initialize the plane.
Definition Plane_inl.h:6
void Flip()
Negates Normal/Distance to switch which side of the plane is front and back.
Definition Plane_inl.h:134
bool IsFinite() const
Checks whether any component is Infinity.
Definition Plane_inl.h:235
const plVec3Template< Type > ProjectOntoPlane(const plVec3Template< Type > &vPoint) const
Projects a point onto a plane (along the planes normal).
Definition Plane_inl.h:167
plPositionOnPlane::Enum GetPointPosition(const plVec3Template< Type > &vPoint) const
Returns on which side of the plane the point lies.
Definition Plane_inl.h:147
Type GetMinimumDistanceTo(const plVec3Template< Type > *pPoints, plUInt32 uiNumPoints, plUInt32 uiStride=sizeof(plVec3Template< Type >)) const
Returns the minimum distance that any of the given points had to the plane.
Definition Plane_inl.h:431
void Transform(const plMat3Template< Type > &m)
Transforms the plane with the given matrix.
Definition Plane_inl.h:84
bool IsEqual(const plPlaneTemplate< Type > &rhs, Type fEpsilon=plMath::DefaultEpsilon< Type >()) const
Checks whether this plane and the other are equal within some threshold.
Definition Plane_inl.h:193
bool GetRayIntersectionBiDirectional(const plVec3Template< Type > &vRayStartPos, const plVec3Template< Type > &vRayDir, Type *out_pIntersectionDistance=nullptr, plVec3Template< Type > *out_pIntersection=nullptr) const
Returns true, if the ray intersects the plane. Intersection time and point are stored in the out-para...
Definition Plane_inl.h:394
plVec4Template< Type > GetAsVec4() const
Returns an plVec4 with the plane normal in x,y,z and the negative distance in w.
Definition Plane_inl.h:47
Enum
Definition Plane.h:10
@ Spanning
Something is spanning a plane, i.e. some points are on the front and some on the back.
Definition Plane.h:14
@ Back
Something is completely on the back side of a plane.
Definition Plane.h:11
@ OnPlane
Something is lying completely on a plane (all points)
Definition Plane.h:13
@ Front
Something is completely in front of a plane.
Definition Plane.h:12
Default enum for returning failure or success, instead of using a bool.
Definition Types.h:54
PL_ALWAYS_INLINE void IgnoreResult()
Used to silence compiler warnings, when success or failure doesn't matter.
Definition Types.h:69