diff options
Diffstat (limited to 'src/BoundingBox.h')
-rw-r--r-- | src/BoundingBox.h | 48 |
1 files changed, 27 insertions, 21 deletions
diff --git a/src/BoundingBox.h b/src/BoundingBox.h index e62711658..a9024dd96 100644 --- a/src/BoundingBox.h +++ b/src/BoundingBox.h @@ -22,19 +22,20 @@ For intersection purposes, though, if the intersection is "sharp" in any coord ( the boxes are considered non-intersecting. */ class cBoundingBox { -public: + public: cBoundingBox(double a_MinX, double a_MaxX, double a_MinY, double a_MaxY, double a_MinZ, double a_MaxZ); cBoundingBox(Vector3d a_Min, Vector3d a_Max); cBoundingBox(Vector3d a_Pos, double a_Radius, double a_Height); /** Constructor that allows to define a bounding box given a center point (a_Pos), a horizontal radius (a_Radius), - a height starting from given center point (a_Height) and a vertical offset (a_VerticalOffset) to adjust the vertical starting point. - For example: cBoundingBox([0, 0, 0], 6, 6, -3) would create a bounding cube from (-3, -3, -3) to (3, 3, 3). */ + a height starting from given center point (a_Height) and a vertical offset (a_VerticalOffset) to adjust the vertical + starting point. For example: cBoundingBox([0, 0, 0], 6, 6, -3) would create a bounding cube from (-3, -3, -3) to (3, + 3, 3). */ cBoundingBox(Vector3d a_Pos, double a_Radius, double a_Height, double a_VerticalOffset); cBoundingBox(Vector3d a_Pos, double a_CubeLength); - #ifdef TOLUA_EXPOSITION // tolua isn't aware of implicitly generated copy constructors - cBoundingBox(const cBoundingBox & a_Orig); - #endif +#ifdef TOLUA_EXPOSITION // tolua isn't aware of implicitly generated copy constructors + cBoundingBox(const cBoundingBox & a_Orig); +#endif /** Moves the entire boundingbox by the specified offset */ void Move(double a_OffX, double a_OffY, double a_OffZ); @@ -42,7 +43,8 @@ public: /** Moves the entire boundingbox by the specified offset */ void Move(Vector3d a_Off); - /** Expands the bounding box by the specified amount in each direction (so the box becomes larger by 2 * Expand in each direction) */ + /** Expands the bounding box by the specified amount in each direction (so the box becomes larger by 2 * Expand in + * each direction) */ void Expand(double a_ExpandX, double a_ExpandY, double a_ExpandZ); /** Returns true if the two bounding boxes intersect */ @@ -72,16 +74,24 @@ public: // tolua_end /** Returns true if this bounding box is intersected by the line specified by its two points - Also calculates the distance along the line in which the intersection occurs, and the face hit (BLOCK_FACE_ constants) - Only forward collisions (a_LineCoeff >= 0) are returned. - Exported to Lua manually, because ToLua++ would generate needless input params (a_LineCoeff, a_Face). */ - bool CalcLineIntersection(Vector3d a_LinePoint1, Vector3d a_LinePoint2, double & a_LineCoeff, eBlockFace & a_Face) const; + Also calculates the distance along the line in which the intersection occurs, and the face hit (BLOCK_FACE_ + constants) Only forward collisions (a_LineCoeff >= 0) are returned. Exported to Lua manually, because ToLua++ would + generate needless input params (a_LineCoeff, a_Face). */ + bool CalcLineIntersection(Vector3d a_LinePoint1, Vector3d a_LinePoint2, double & a_LineCoeff, eBlockFace & a_Face) + const; /** Returns true if the specified bounding box is intersected by the line specified by its two points - Also calculates the distance along the line in which the intersection occurs, and the face hit (BLOCK_FACE_ constants) - Only forward collisions (a_LineCoeff >= 0) are returned. - Exported to Lua manually, because ToLua++ would generate needless input params (a_LineCoeff, a_Face). */ - static bool CalcLineIntersection(Vector3d a_Min, Vector3d a_Max, Vector3d a_LinePoint1, Vector3d a_LinePoint2, double & a_LineCoeff, eBlockFace & a_Face); + Also calculates the distance along the line in which the intersection occurs, and the face hit (BLOCK_FACE_ + constants) Only forward collisions (a_LineCoeff >= 0) are returned. Exported to Lua manually, because ToLua++ would + generate needless input params (a_LineCoeff, a_Face). */ + static bool CalcLineIntersection( + Vector3d a_Min, + Vector3d a_Max, + Vector3d a_LinePoint1, + Vector3d a_LinePoint2, + double & a_LineCoeff, + eBlockFace & a_Face + ); /** Calculates the intersection of the two bounding boxes; returns true if nonempty. Exported manually, because ToLua++ would generate needless input params (a_Intersection). */ @@ -102,12 +112,8 @@ public: // tolua_end -protected: + protected: Vector3d m_Min; Vector3d m_Max; -} ; // tolua_export - - - - +}; // tolua_export |