diff options
author | LogicParrot <LogicParrot@users.noreply.github.com> | 2016-01-22 20:52:49 +0100 |
---|---|---|
committer | LogicParrot <LogicParrot@users.noreply.github.com> | 2016-01-22 20:52:49 +0100 |
commit | 7ba432b338ffa4c448de9d68d0f1b1e0024cd50a (patch) | |
tree | 706035da78a49c971f6d3bf3d812582581ce93a4 /src/BoundingBox.h | |
parent | Merge pull request #2894 from LogicParrot/spider (diff) | |
parent | Improved tamed wolf pack cooperation and projectile reactions (diff) | |
download | cuberite-7ba432b338ffa4c448de9d68d0f1b1e0024cd50a.tar cuberite-7ba432b338ffa4c448de9d68d0f1b1e0024cd50a.tar.gz cuberite-7ba432b338ffa4c448de9d68d0f1b1e0024cd50a.tar.bz2 cuberite-7ba432b338ffa4c448de9d68d0f1b1e0024cd50a.tar.lz cuberite-7ba432b338ffa4c448de9d68d0f1b1e0024cd50a.tar.xz cuberite-7ba432b338ffa4c448de9d68d0f1b1e0024cd50a.tar.zst cuberite-7ba432b338ffa4c448de9d68d0f1b1e0024cd50a.zip |
Diffstat (limited to 'src/BoundingBox.h')
-rw-r--r-- | src/BoundingBox.h | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/src/BoundingBox.h b/src/BoundingBox.h index 1f9d0ebee..c2aa40dc7 100644 --- a/src/BoundingBox.h +++ b/src/BoundingBox.h @@ -27,56 +27,57 @@ public: cBoundingBox(double a_MinX, double a_MaxX, double a_MinY, double a_MaxY, double a_MinZ, double a_MaxZ); cBoundingBox(const Vector3d & a_Min, const Vector3d & a_Max); cBoundingBox(const Vector3d & a_Pos, double a_Radius, double a_Height); + cBoundingBox(const Vector3d & a_Pos, double a_CubeLength); cBoundingBox(const cBoundingBox & a_Orig); - + /** Moves the entire boundingbox by the specified offset */ void Move(double a_OffX, double a_OffY, double a_OffZ); - + /** Moves the entire boundingbox by the specified offset */ void Move(const 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) */ void Expand(double a_ExpandX, double a_ExpandY, double a_ExpandZ); - + /** Returns true if the two bounding boxes intersect */ bool DoesIntersect(const cBoundingBox & a_Other); - + /** Returns the union of the two bounding boxes */ cBoundingBox Union(const cBoundingBox & a_Other); - + /** Returns true if the point is inside the bounding box */ bool IsInside(const Vector3d & a_Point); - + /** Returns true if the point is inside the bounding box */ bool IsInside(double a_X, double a_Y, double a_Z); - + /** Returns true if a_Other is inside this bounding box */ bool IsInside(cBoundingBox & a_Other); - + /** Returns true if a boundingbox specified by a_Min and a_Max is inside this bounding box */ bool IsInside(const Vector3d & a_Min, const Vector3d & a_Max); - + /** Returns true if the specified point is inside the bounding box specified by its min / max corners */ static bool IsInside(const Vector3d & a_Min, const Vector3d & a_Max, const Vector3d & a_Point); - + /** Returns true if the specified point is inside the bounding box specified by its min / max corners */ static bool IsInside(const Vector3d & a_Min, const Vector3d & a_Max, double a_X, double a_Y, double a_Z); - + /** 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 (0 .. 1) Only forward collisions (a_LineCoeff >= 0) are returned. */ bool CalcLineIntersection(const Vector3d & a_Line1, const Vector3d & a_Line2, double & a_LineCoeff, eBlockFace & a_Face); - + /** 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 (0 .. 1) and the face hit (BLOCK_FACE_ constants) Only forward collisions (a_LineCoeff >= 0) are returned. */ static bool CalcLineIntersection(const Vector3d & a_Min, const Vector3d & a_Max, const Vector3d & a_Line1, const Vector3d & a_Line2, double & a_LineCoeff, eBlockFace & a_Face); - + // tolua_end - + /** Calculates the intersection of the two bounding boxes; returns true if nonempty */ bool Intersect(const cBoundingBox & a_Other, cBoundingBox & a_Intersection); - + double GetMinX(void) const { return m_Min.x; } double GetMinY(void) const { return m_Min.y; } double GetMinZ(void) const { return m_Min.z; } @@ -84,14 +85,14 @@ public: double GetMaxX(void) const { return m_Max.x; } double GetMaxY(void) const { return m_Max.y; } double GetMaxZ(void) const { return m_Max.z; } - + const Vector3d & GetMin(void) const { return m_Min; } const Vector3d & GetMax(void) const { return m_Max; } - + protected: Vector3d m_Min; Vector3d m_Max; - + } ; // tolua_export |