From f91ff9e68b6332ce6ca1903fed4f7a17f6e5c80d Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sun, 1 Sep 2013 12:25:53 +0200 Subject: Added the cBoundingBox class. --- source/BoundingBox.cpp | 195 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 195 insertions(+) create mode 100644 source/BoundingBox.cpp (limited to 'source/BoundingBox.cpp') diff --git a/source/BoundingBox.cpp b/source/BoundingBox.cpp new file mode 100644 index 000000000..9af726223 --- /dev/null +++ b/source/BoundingBox.cpp @@ -0,0 +1,195 @@ + +// BoundingBox.cpp + +// Implements the cBoundingBox class representing an axis-aligned bounding box with floatingpoint coords + +#include "Globals.h" +#include "BoundingBox.h" + + + + + +cBoundingBox::cBoundingBox(double a_MinX, double a_MaxX, double a_MinY, double a_MaxY, double a_MinZ, double a_MaxZ) : + m_Min(a_MinX, a_MinY, a_MinZ), + m_Max(a_MaxX, a_MaxY, a_MaxZ) +{ +} + + + + + +cBoundingBox::cBoundingBox(const Vector3d & a_Min, const Vector3d & a_Max) : + m_Min(a_Min), + m_Max(a_Max) +{ +} + + + + + +cBoundingBox::cBoundingBox(const Vector3d & a_Pos, double a_Radius, double a_Height) : + m_Min(a_Pos.x - a_Radius, a_Pos.y, a_Pos.z - a_Radius), + m_Max(a_Pos.x + a_Radius, a_Pos.y + a_Height, a_Pos.z + a_Radius) +{ +} + + + + + +cBoundingBox::cBoundingBox(const cBoundingBox & a_Orig) : + m_Min(a_Orig.m_Min), + m_Max(a_Orig.m_Max) +{ +} + + + + + +void cBoundingBox::Move(double a_OffX, double a_OffY, double a_OffZ) +{ + m_Min.x += a_OffX; + m_Min.y += a_OffY; + m_Min.z += a_OffZ; + m_Max.x += a_OffX; + m_Max.y += a_OffY; + m_Max.z += a_OffZ; +} + + + + + +void cBoundingBox::Move(const Vector3d & a_Off) +{ + m_Min.x += a_Off.x; + m_Min.y += a_Off.y; + m_Min.z += a_Off.z; + m_Max.x += a_Off.x; + m_Max.y += a_Off.y; + m_Max.z += a_Off.z; +} + + + + + +void cBoundingBox::Expand(double a_ExpandX, double a_ExpandY, double a_ExpandZ) +{ + m_Min.x -= a_ExpandX; + m_Min.y -= a_ExpandY; + m_Min.z -= a_ExpandZ; + m_Max.x += a_ExpandX; + m_Max.y += a_ExpandY; + m_Max.z += a_ExpandZ; +} + + + + + +bool cBoundingBox::DoesIntersect(const cBoundingBox & a_Other) +{ + return ( + ((a_Other.m_Min.x < m_Max.x) && (a_Other.m_Max.x > m_Min.x)) && // X coords intersect + ((a_Other.m_Min.y < m_Max.y) && (a_Other.m_Max.y > m_Min.y)) && // Y coords intersect + ((a_Other.m_Min.z < m_Max.z) && (a_Other.m_Max.z > m_Min.z)) // Z coords intersect + ); +} + + + + + +cBoundingBox cBoundingBox::Union(const cBoundingBox & a_Other) +{ + return cBoundingBox( + std::min(m_Min.x, a_Other.m_Min.x), + std::min(m_Min.y, a_Other.m_Min.y), + std::min(m_Min.z, a_Other.m_Min.z), + std::max(m_Max.x, a_Other.m_Max.x), + std::max(m_Max.y, a_Other.m_Max.y), + std::max(m_Max.z, a_Other.m_Max.z) + ); +} + + + + + +bool cBoundingBox::IsInside(const Vector3d & a_Point) +{ + return ( + ((a_Point.x >= m_Min.x) && (a_Point.x < m_Max.x)) && + ((a_Point.y >= m_Min.y) && (a_Point.y < m_Max.y)) && + ((a_Point.z >= m_Min.z) && (a_Point.z < m_Max.z)) + ); +} + + + + + +bool cBoundingBox::IsInside(double a_X, double a_Y,double a_Z) +{ + return ( + ((a_X >= m_Min.x) && (a_X < m_Max.x)) && + ((a_Y >= m_Min.y) && (a_Y < m_Max.y)) && + ((a_Z >= m_Min.z) && (a_Z < m_Max.z)) + ); +} + + + + + +bool cBoundingBox::IsInside(cBoundingBox & a_Other) +{ + // If both a_Other's coords are inside this, then the entire a_Other is inside + return (IsInside(a_Other.m_Min) && IsInside(a_Other.m_Max)); +} + + + + + +bool cBoundingBox::IsInside(const Vector3d & a_Min, const Vector3d & a_Max) +{ + // If both coords are inside this, then the entire a_Other is inside + return (IsInside(a_Min) && IsInside(a_Max)); +} + + + + + +bool cBoundingBox::Intersect(const cBoundingBox & a_Other, cBoundingBox & a_Intersection) +{ + a_Intersection.m_Min.x = std::max(m_Min.x, a_Other.m_Min.x); + a_Intersection.m_Max.x = std::min(m_Max.x, a_Other.m_Max.x); + if (a_Intersection.m_Min.x >= a_Intersection.m_Max.x) + { + return false; + } + a_Intersection.m_Min.y = std::max(m_Min.y, a_Other.m_Min.y); + a_Intersection.m_Max.y = std::min(m_Max.y, a_Other.m_Max.y); + if (a_Intersection.m_Min.y >= a_Intersection.m_Max.y) + { + return false; + } + a_Intersection.m_Min.z = std::max(m_Min.z, a_Other.m_Min.z); + a_Intersection.m_Max.z = std::min(m_Max.z, a_Other.m_Max.z); + if (a_Intersection.m_Min.z >= a_Intersection.m_Max.z) + { + return false; + } + return true; +} + + + + -- cgit v1.2.3 From 5fccd67bada2be7a3fbb2df3abf08bfde58b600b Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sun, 1 Sep 2013 19:08:51 +0200 Subject: Added line collision calculation to cBoundingBox. --- source/BoundingBox.cpp | 114 ++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 104 insertions(+), 10 deletions(-) (limited to 'source/BoundingBox.cpp') diff --git a/source/BoundingBox.cpp b/source/BoundingBox.cpp index 9af726223..c845fe372 100644 --- a/source/BoundingBox.cpp +++ b/source/BoundingBox.cpp @@ -5,6 +5,7 @@ #include "Globals.h" #include "BoundingBox.h" +#include "Defines.h" @@ -123,11 +124,7 @@ cBoundingBox cBoundingBox::Union(const cBoundingBox & a_Other) bool cBoundingBox::IsInside(const Vector3d & a_Point) { - return ( - ((a_Point.x >= m_Min.x) && (a_Point.x < m_Max.x)) && - ((a_Point.y >= m_Min.y) && (a_Point.y < m_Max.y)) && - ((a_Point.z >= m_Min.z) && (a_Point.z < m_Max.z)) - ); + return IsInside(m_Min, m_Max, a_Point); } @@ -136,11 +133,7 @@ bool cBoundingBox::IsInside(const Vector3d & a_Point) bool cBoundingBox::IsInside(double a_X, double a_Y,double a_Z) { - return ( - ((a_X >= m_Min.x) && (a_X < m_Max.x)) && - ((a_Y >= m_Min.y) && (a_Y < m_Max.y)) && - ((a_Z >= m_Min.z) && (a_Z < m_Max.z)) - ); + return IsInside(m_Min, m_Max, a_X, a_Y, a_Z); } @@ -167,6 +160,107 @@ bool cBoundingBox::IsInside(const Vector3d & a_Min, const Vector3d & a_Max) +bool cBoundingBox::IsInside(const Vector3d & a_Min, const Vector3d & a_Max, const Vector3d & a_Point) +{ + return ( + ((a_Point.x >= a_Min.x) && (a_Point.x < a_Max.x)) && + ((a_Point.y >= a_Min.y) && (a_Point.y < a_Max.y)) && + ((a_Point.z >= a_Min.z) && (a_Point.z < a_Max.z)) + ); +} + + + + + +bool cBoundingBox::IsInside(const Vector3d & a_Min, const Vector3d & a_Max, double a_X, double a_Y, double a_Z) +{ + return ( + ((a_X >= a_Min.x) && (a_X < a_Max.x)) && + ((a_Y >= a_Min.y) && (a_Y < a_Max.y)) && + ((a_Z >= a_Min.z) && (a_Z < a_Max.z)) + ); +} + + + + + +bool cBoundingBox::CalcLineIntersection(const Vector3d & a_Line1, const Vector3d & a_Line2, double & a_LineCoeff, char & a_Face) +{ + return CalcLineIntersection(m_Min, m_Max, a_Line1, a_Line2, a_LineCoeff, a_Face); +} + + + + + +bool cBoundingBox::CalcLineIntersection(const Vector3d & a_Min, const Vector3d & a_Max, const Vector3d & a_Line1, const Vector3d & a_Line2, double & a_LineCoeff, char & a_Face) +{ + char Face = 0; + double Coeff = Vector3d::NO_INTERSECTION; + + // Check each individual bbox face for intersection with the line, remember the one with the lowest coeff + double c = a_Line1.LineCoeffToXYPlane(a_Line2, a_Min.z); + if (c < Coeff) + { + Face = (a_Line1.z > a_Line2.z) ? BLOCK_FACE_ZP : BLOCK_FACE_ZM; + Coeff = c; + } + c = a_Line1.LineCoeffToXYPlane(a_Line2, a_Max.z); + if (c < Coeff) + { + Face = (a_Line1.z > a_Line2.z) ? BLOCK_FACE_ZP : BLOCK_FACE_ZM; + Coeff = c; + } + c = a_Line1.LineCoeffToXZPlane(a_Line2, a_Min.y); + if (c < Coeff) + { + Face = (a_Line1.y > a_Line2.y) ? BLOCK_FACE_YP : BLOCK_FACE_YM; + Coeff = c; + } + c = a_Line1.LineCoeffToXZPlane(a_Line2, a_Max.y); + if (c < Coeff) + { + Face = (a_Line1.y > a_Line2.y) ? BLOCK_FACE_YP : BLOCK_FACE_YM; + Coeff = c; + } + c = a_Line1.LineCoeffToYZPlane(a_Line2, a_Min.x); + if (c < Coeff) + { + Face = (a_Line1.x > a_Line2.x) ? BLOCK_FACE_XP : BLOCK_FACE_XM; + Coeff = c; + } + c = a_Line1.LineCoeffToYZPlane(a_Line2, a_Max.x); + if (c < Coeff) + { + Face = (a_Line1.x > a_Line2.x) ? BLOCK_FACE_XP : BLOCK_FACE_XM; + Coeff = c; + } + + if (Coeff >= Vector3d::NO_INTERSECTION) + { + // There has been no intersection + return false; + } + + Vector3d Intersection = a_Line1 + (a_Line2 - a_Line1) * Coeff; + if (!IsInside(a_Min, a_Max, Intersection)) + { + // The line intersects with the individual wall planes, but not within this bounding box + return false; + } + + // True intersection, return all the values: + a_LineCoeff = Coeff; + a_Face = Face; + return true; +} + + + + + bool cBoundingBox::Intersect(const cBoundingBox & a_Other, cBoundingBox & a_Intersection) { a_Intersection.m_Min.x = std::max(m_Min.x, a_Other.m_Min.x); -- cgit v1.2.3 From e35402c61aa8c9749ff65e5a083184d369f79f15 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sun, 1 Sep 2013 20:39:22 +0200 Subject: Fixed an error in cBoundingBox's line-collision algorithm. --- source/BoundingBox.cpp | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'source/BoundingBox.cpp') diff --git a/source/BoundingBox.cpp b/source/BoundingBox.cpp index c845fe372..bf53f3c6a 100644 --- a/source/BoundingBox.cpp +++ b/source/BoundingBox.cpp @@ -202,37 +202,37 @@ bool cBoundingBox::CalcLineIntersection(const Vector3d & a_Min, const Vector3d & // Check each individual bbox face for intersection with the line, remember the one with the lowest coeff double c = a_Line1.LineCoeffToXYPlane(a_Line2, a_Min.z); - if (c < Coeff) + if ((c < Coeff) && IsInside(a_Min, a_Max, a_Line1 + (a_Line2 - a_Line1) * c)) { Face = (a_Line1.z > a_Line2.z) ? BLOCK_FACE_ZP : BLOCK_FACE_ZM; Coeff = c; } c = a_Line1.LineCoeffToXYPlane(a_Line2, a_Max.z); - if (c < Coeff) + if ((c < Coeff) && IsInside(a_Min, a_Max, a_Line1 + (a_Line2 - a_Line1) * c)) { Face = (a_Line1.z > a_Line2.z) ? BLOCK_FACE_ZP : BLOCK_FACE_ZM; Coeff = c; } c = a_Line1.LineCoeffToXZPlane(a_Line2, a_Min.y); - if (c < Coeff) + if ((c < Coeff) && IsInside(a_Min, a_Max, a_Line1 + (a_Line2 - a_Line1) * c)) { Face = (a_Line1.y > a_Line2.y) ? BLOCK_FACE_YP : BLOCK_FACE_YM; Coeff = c; } c = a_Line1.LineCoeffToXZPlane(a_Line2, a_Max.y); - if (c < Coeff) + if ((c < Coeff) && IsInside(a_Min, a_Max, a_Line1 + (a_Line2 - a_Line1) * c)) { Face = (a_Line1.y > a_Line2.y) ? BLOCK_FACE_YP : BLOCK_FACE_YM; Coeff = c; } c = a_Line1.LineCoeffToYZPlane(a_Line2, a_Min.x); - if (c < Coeff) + if ((c < Coeff) && IsInside(a_Min, a_Max, a_Line1 + (a_Line2 - a_Line1) * c)) { Face = (a_Line1.x > a_Line2.x) ? BLOCK_FACE_XP : BLOCK_FACE_XM; Coeff = c; } c = a_Line1.LineCoeffToYZPlane(a_Line2, a_Max.x); - if (c < Coeff) + if ((c < Coeff) && IsInside(a_Min, a_Max, a_Line1 + (a_Line2 - a_Line1) * c)) { Face = (a_Line1.x > a_Line2.x) ? BLOCK_FACE_XP : BLOCK_FACE_XM; Coeff = c; @@ -244,14 +244,6 @@ bool cBoundingBox::CalcLineIntersection(const Vector3d & a_Min, const Vector3d & return false; } - Vector3d Intersection = a_Line1 + (a_Line2 - a_Line1) * Coeff; - if (!IsInside(a_Min, a_Max, Intersection)) - { - // The line intersects with the individual wall planes, but not within this bounding box - return false; - } - - // True intersection, return all the values: a_LineCoeff = Coeff; a_Face = Face; return true; -- cgit v1.2.3 From 4f04724cfdbc4b6c7908423d0ad232a2ef374b1d Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sun, 1 Sep 2013 22:38:09 +0200 Subject: Made cBoundingBox class inclusive in both coord edges. Also added (a disabled) self-test to cBoundingBox. --- source/BoundingBox.cpp | 60 ++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 51 insertions(+), 9 deletions(-) (limited to 'source/BoundingBox.cpp') diff --git a/source/BoundingBox.cpp b/source/BoundingBox.cpp index bf53f3c6a..e2b8c313e 100644 --- a/source/BoundingBox.cpp +++ b/source/BoundingBox.cpp @@ -11,6 +11,48 @@ +#if 0 + +/// A simple self-test that is executed on program start, used to verify bbox functionality +class SelfTest +{ +public: + SelfTest(void) + { + Vector3d Min(1, 1, 1); + Vector3d Max(2, 2, 2); + Vector3d LineDefs[] = + { + Vector3d(1.5, 4, 1.5), Vector3d(1.5, 3, 1.5), // Should intersect at 2, face 1 (YP) + Vector3d(1.5, 0, 1.5), Vector3d(1.5, 4, 1.5), // Should intersect at 0.25, face 0 (YM) + Vector3d(0, 0, 0), Vector3d(2, 2, 2), // Should intersect at 0.5, face 0, 3 or 5 (anyM) + Vector3d(0.999, 0, 1.5), Vector3d(0.999, 4, 1.5), // Should not intersect + Vector3d(1.999, 0, 1.5), Vector3d(1.999, 4, 1.5), // Should intersect at 0.25, face 0 (YM) + Vector3d(2.001, 0, 1.5), Vector3d(2.001, 4, 1.5), // Should not intersect + } ; + for (int i = 0; i < ARRAYCOUNT(LineDefs) / 2; i++) + { + double LineCoeff; + char Face; + Vector3d Line1 = LineDefs[2 * i]; + Vector3d Line2 = LineDefs[2 * i + 1]; + bool res = cBoundingBox::CalcLineIntersection(Min, Max, Line1, Line2, LineCoeff, Face); + printf("LineIntersection({%.02f, %.02f, %.02f}, {%.02f, %.02f, %.02f}) -> %d, %.05f, %d\n", + Line1.x, Line1.y, Line1.z, + Line2.x, Line2.y, Line2.z, + res ? 1 : 0, LineCoeff, Face + ); + } // for i - LineDefs[] + printf("BoundingBox selftest complete."); + } +} Test; + +#endif + + + + + cBoundingBox::cBoundingBox(double a_MinX, double a_MaxX, double a_MinY, double a_MaxY, double a_MinZ, double a_MaxZ) : m_Min(a_MinX, a_MinY, a_MinZ), m_Max(a_MaxX, a_MaxY, a_MaxZ) @@ -96,9 +138,9 @@ void cBoundingBox::Expand(double a_ExpandX, double a_ExpandY, double a_ExpandZ) bool cBoundingBox::DoesIntersect(const cBoundingBox & a_Other) { return ( - ((a_Other.m_Min.x < m_Max.x) && (a_Other.m_Max.x > m_Min.x)) && // X coords intersect - ((a_Other.m_Min.y < m_Max.y) && (a_Other.m_Max.y > m_Min.y)) && // Y coords intersect - ((a_Other.m_Min.z < m_Max.z) && (a_Other.m_Max.z > m_Min.z)) // Z coords intersect + ((a_Other.m_Min.x <= m_Max.x) && (a_Other.m_Max.x >= m_Min.x)) && // X coords intersect + ((a_Other.m_Min.y <= m_Max.y) && (a_Other.m_Max.y >= m_Min.y)) && // Y coords intersect + ((a_Other.m_Min.z <= m_Max.z) && (a_Other.m_Max.z >= m_Min.z)) // Z coords intersect ); } @@ -163,9 +205,9 @@ bool cBoundingBox::IsInside(const Vector3d & a_Min, const Vector3d & a_Max) bool cBoundingBox::IsInside(const Vector3d & a_Min, const Vector3d & a_Max, const Vector3d & a_Point) { return ( - ((a_Point.x >= a_Min.x) && (a_Point.x < a_Max.x)) && - ((a_Point.y >= a_Min.y) && (a_Point.y < a_Max.y)) && - ((a_Point.z >= a_Min.z) && (a_Point.z < a_Max.z)) + ((a_Point.x >= a_Min.x) && (a_Point.x <= a_Max.x)) && + ((a_Point.y >= a_Min.y) && (a_Point.y <= a_Max.y)) && + ((a_Point.z >= a_Min.z) && (a_Point.z <= a_Max.z)) ); } @@ -176,9 +218,9 @@ bool cBoundingBox::IsInside(const Vector3d & a_Min, const Vector3d & a_Max, cons bool cBoundingBox::IsInside(const Vector3d & a_Min, const Vector3d & a_Max, double a_X, double a_Y, double a_Z) { return ( - ((a_X >= a_Min.x) && (a_X < a_Max.x)) && - ((a_Y >= a_Min.y) && (a_Y < a_Max.y)) && - ((a_Z >= a_Min.z) && (a_Z < a_Max.z)) + ((a_X >= a_Min.x) && (a_X <= a_Max.x)) && + ((a_Y >= a_Min.y) && (a_Y <= a_Max.y)) && + ((a_Z >= a_Min.z) && (a_Z <= a_Max.z)) ); } -- cgit v1.2.3 From f5e0c8c77e66685f58a5013674c5f74a647d69a5 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Mon, 2 Sep 2013 19:51:13 +0200 Subject: cBoundingBox: Only forward collisions are calculated. --- source/BoundingBox.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'source/BoundingBox.cpp') diff --git a/source/BoundingBox.cpp b/source/BoundingBox.cpp index e2b8c313e..d8a1bc679 100644 --- a/source/BoundingBox.cpp +++ b/source/BoundingBox.cpp @@ -239,42 +239,50 @@ bool cBoundingBox::CalcLineIntersection(const Vector3d & a_Line1, const Vector3d bool cBoundingBox::CalcLineIntersection(const Vector3d & a_Min, const Vector3d & a_Max, const Vector3d & a_Line1, const Vector3d & a_Line2, double & a_LineCoeff, char & a_Face) { + if (IsInside(a_Min, a_Max, a_Line1)) + { + // The starting point is inside the bounding box. + a_LineCoeff = 0; + a_Face = BLOCK_FACE_YM; // Make it look as the top face was hit, although none really are. + return true; + } + char Face = 0; double Coeff = Vector3d::NO_INTERSECTION; // Check each individual bbox face for intersection with the line, remember the one with the lowest coeff double c = a_Line1.LineCoeffToXYPlane(a_Line2, a_Min.z); - if ((c < Coeff) && IsInside(a_Min, a_Max, a_Line1 + (a_Line2 - a_Line1) * c)) + if ((c >= 0) && (c < Coeff) && IsInside(a_Min, a_Max, a_Line1 + (a_Line2 - a_Line1) * c)) { Face = (a_Line1.z > a_Line2.z) ? BLOCK_FACE_ZP : BLOCK_FACE_ZM; Coeff = c; } c = a_Line1.LineCoeffToXYPlane(a_Line2, a_Max.z); - if ((c < Coeff) && IsInside(a_Min, a_Max, a_Line1 + (a_Line2 - a_Line1) * c)) + if ((c >= 0) && (c < Coeff) && IsInside(a_Min, a_Max, a_Line1 + (a_Line2 - a_Line1) * c)) { Face = (a_Line1.z > a_Line2.z) ? BLOCK_FACE_ZP : BLOCK_FACE_ZM; Coeff = c; } c = a_Line1.LineCoeffToXZPlane(a_Line2, a_Min.y); - if ((c < Coeff) && IsInside(a_Min, a_Max, a_Line1 + (a_Line2 - a_Line1) * c)) + if ((c >= 0) && (c < Coeff) && IsInside(a_Min, a_Max, a_Line1 + (a_Line2 - a_Line1) * c)) { Face = (a_Line1.y > a_Line2.y) ? BLOCK_FACE_YP : BLOCK_FACE_YM; Coeff = c; } c = a_Line1.LineCoeffToXZPlane(a_Line2, a_Max.y); - if ((c < Coeff) && IsInside(a_Min, a_Max, a_Line1 + (a_Line2 - a_Line1) * c)) + if ((c >= 0) && (c >= 0) && (c < Coeff) && IsInside(a_Min, a_Max, a_Line1 + (a_Line2 - a_Line1) * c)) { Face = (a_Line1.y > a_Line2.y) ? BLOCK_FACE_YP : BLOCK_FACE_YM; Coeff = c; } c = a_Line1.LineCoeffToYZPlane(a_Line2, a_Min.x); - if ((c < Coeff) && IsInside(a_Min, a_Max, a_Line1 + (a_Line2 - a_Line1) * c)) + if ((c >= 0) && (c < Coeff) && IsInside(a_Min, a_Max, a_Line1 + (a_Line2 - a_Line1) * c)) { Face = (a_Line1.x > a_Line2.x) ? BLOCK_FACE_XP : BLOCK_FACE_XM; Coeff = c; } c = a_Line1.LineCoeffToYZPlane(a_Line2, a_Max.x); - if ((c < Coeff) && IsInside(a_Min, a_Max, a_Line1 + (a_Line2 - a_Line1) * c)) + if ((c >= 0) && (c < Coeff) && IsInside(a_Min, a_Max, a_Line1 + (a_Line2 - a_Line1) * c)) { Face = (a_Line1.x > a_Line2.x) ? BLOCK_FACE_XP : BLOCK_FACE_XM; Coeff = c; -- cgit v1.2.3