6 #ifndef _INC_cTriangle3_H
7 #define _INC_cTriangle3_H
15 #include "../Math/cFloatEst.h"
51 return other.m_aPt[0] == m_aPt[0] && other.m_aPt[1] == m_aPt[1] && other.m_aPt[2] == m_aPt[2];
55 return other.m_aPt[0] != m_aPt[0] || other.m_aPt[1] != m_aPt[1] || other.m_aPt[2] != m_aPt[2];
61 if (m_aPt[1] == m_aPt[0])
63 if (m_aPt[2] == m_aPt[0])
65 if (m_aPt[2] == m_aPt[1])
73 return cPlanef(m_aPt[0], m_aPt[1], m_aPt[2]);
88 (m_aPt[0].x + m_aPt[1].x + m_aPt[2].x) / 3.0f,
89 (m_aPt[0].y + m_aPt[1].y + m_aPt[2].y) / 3.0f,
90 (m_aPt[0].z + m_aPt[1].z + m_aPt[2].z) / 3.0f
104 return vNorm.
GetDot(vLookDir) <= 0.0f;
113 return (isOnSameSide(p, m_aPt[0], m_aPt[1], m_aPt[2]) &&
114 isOnSameSide(p, m_aPt[1], m_aPt[0], m_aPt[2]) &&
115 isOnSameSide(p, m_aPt[2], m_aPt[0], m_aPt[1]));
118 #ifdef USE_FLOAT_IEEE
147 bool isPointInsideFast(
const cVector3f& p)
const
149 return isPointInside(p);
162 return (cp1.
GetDot(cp2) > 0.0f);
183 outIntersection = linePoint + (lineVect * t);
200 if (!getIntersectionOfPlaneWithLine(linePoint, lineVect, outIntersection))
202 return isPointInside(outIntersection);
211 vPos.
x = (1.0f - f -
g) * (m_aPt[0].x) + f * (m_aPt[1].
x) +
g * (m_aPt[2].x);
212 vPos.
y = (1.0f - f -
g) * (m_aPt[0].y) + f * (m_aPt[1].
y) +
g * (m_aPt[2].y);
213 vPos.
z = (1.0f - f -
g) * (m_aPt[0].z) + f * (m_aPt[1].
z) +
g * (m_aPt[2].z);
234 for (
int i = 0; i < 3; i++)
236 m_aPt[i] = m_aPt[i].
GetProj(mMatrix);
241 for (
int i = 0; i < 3; i++)
248 for (
int i = 0; i < 3; i++)
#define GRAYLIB_LINK
Definition: GrayLibBase.h:35
Using X files without the sources and the makefile How to use you just create a debug directory e g
Definition: Readme.txt:21
Definition: cMatrix.h:194
Definition: cTriangle3.h:22
cTriangle3f(const cVector3f &a, const cVector3f &b, const cVector3f &c) noexcept
Definition: cTriangle3.h:42
bool isOnSameSide(const cVector3f &p1, const cVector3f &p2, const cVector3f &a, const cVector3f &b) const
Definition: cTriangle3.h:153
bool isPointInsideFast(const cVector3f &p) const
Definition: cTriangle3.h:119
bool operator!=(const cTriangle3f &other) const noexcept
Definition: cTriangle3.h:53
bool getIntersectionWithLine(const cVector3f &linePoint, const cVector3f &lineVect, cVector3f &outIntersection) const
Definition: cTriangle3.h:187
UNITTEST_FRIEND(cTriangle3)
float DVALUE_t
Dimension value type.
Definition: cTriangle3.h:29
cTriangle3f() noexcept
Definition: cTriangle3.h:33
cTriangle3f(const cVector3f *p)
Definition: cTriangle3.h:36
cVector3f get_Normal() const
Definition: cTriangle3.h:75
void MultV(const cVector3f vMult)
Definition: cTriangle3.h:239
bool isFrontFacing(const cVector3f &vLookDir) const
Definition: cTriangle3.h:95
void setTri(const cVector3f &a, const cVector3f &b, const cVector3f &c)
Definition: cTriangle3.h:225
cVector3f get_Center() const
Definition: cTriangle3.h:84
cPlanef get_Plane() const
Definition: cTriangle3.h:70
bool getIntersectionOfPlaneWithLine(const cVector3f &linePoint, const cVector3f &lineVect, cVector3f &outIntersection) const
Definition: cTriangle3.h:165
bool isDegenerate() const noexcept
Definition: cTriangle3.h:58
void setTri(const cVector3f *p)
Definition: cTriangle3.h:219
void TransformCoords(const cMatrix4x4f &mMatrix)
Definition: cTriangle3.h:232
cVector3f GetBaryCentric(DVALUE_t f, DVALUE_t g) const
Definition: cTriangle3.h:205
bool operator==(const cTriangle3f &other) const noexcept
Definition: cTriangle3.h:49
bool isPointInside(const cVector3f &p) const
Definition: cTriangle3.h:107
void DivV(const cVector3f vMult)
Definition: cTriangle3.h:246
THIS_t GetCross(const THIS_t &rB) const
Definition: cVecT.h:621
TYPE y
Definition: cVecT.h:545
TYPE z
Definition: cVecT.h:545
TYPE x
Definition: cVecT.h:545
TYPE SetNormalized(void) noexcept
Definition: cVecT.h:334
TYPE GetDot(const THIS_t &v2) const
Definition: cVecT.h:255
THIS_t GetProj(const cMatrix4x4f &M) const
Definition: cVector.cpp:98
static const UINT32 k_SIGN_MASK
1 bit = value sign (Sign_bit)
Definition: cFloat.h:31
static UINT32 toBits(float src) noexcept
Definition: cFloat.h:53
UNITTEST2_PREDEF(cQuadtree)
D3DVALUE y
Definition: MathDX.h:60
D3DVALUE z
Definition: MathDX.h:60
D3DVALUE x
Definition: MathDX.h:60