Base: add methods to get volume and get max/min points
This commit is contained in:
@@ -208,6 +208,10 @@ public:
|
||||
|
||||
/** Returns the center of the box. */
|
||||
inline Vector3<Precision> GetCenter () const;
|
||||
/** Returns the minimum point of the box. */
|
||||
inline Vector3<Precision> GetMinimum () const;
|
||||
/** Returns the maximum point of the box. */
|
||||
inline Vector3<Precision> GetMaximum () const;
|
||||
/** Compute the diagonal length of this bounding box.
|
||||
* @note It's up to the client programmer to make sure that this bounding box is valid.
|
||||
*/
|
||||
@@ -225,6 +229,8 @@ public:
|
||||
inline Precision LengthY () const;
|
||||
/** Calculates expansion in z-direction. */
|
||||
inline Precision LengthZ () const;
|
||||
/** Calculates the volume. If the box is invalid a negative value is returned */
|
||||
inline Precision Volume () const;
|
||||
/** Moves in x-direction. */
|
||||
inline void MoveX (Precision value);
|
||||
/** Moves in y-direction. */
|
||||
@@ -971,6 +977,18 @@ inline Vector3<Precision> BoundBox3<Precision>::GetCenter () const
|
||||
(MaxZ + MinZ) / 2);
|
||||
}
|
||||
|
||||
template <class Precision>
|
||||
inline Vector3<Precision> BoundBox3<Precision>::GetMinimum () const
|
||||
{
|
||||
return Vector3<Precision>(MinX, MinY, MinZ);
|
||||
}
|
||||
|
||||
template <class Precision>
|
||||
inline Vector3<Precision> BoundBox3<Precision>::GetMaximum () const
|
||||
{
|
||||
return Vector3<Precision>(MaxX, MaxY, MaxZ);
|
||||
}
|
||||
|
||||
template <class Precision>
|
||||
inline Precision BoundBox3<Precision>::CalcDiagonalLength () const
|
||||
{
|
||||
@@ -1018,6 +1036,15 @@ inline Precision BoundBox3<Precision>::LengthZ () const
|
||||
return MaxZ - MinZ;
|
||||
}
|
||||
|
||||
template <class Precision>
|
||||
inline Precision BoundBox3<Precision>::Volume () const
|
||||
{
|
||||
if (!IsValid()) {
|
||||
return -1.0;
|
||||
}
|
||||
return LengthX() * LengthY() * LengthZ();
|
||||
}
|
||||
|
||||
template <class Precision>
|
||||
inline void BoundBox3<Precision>::MoveX (Precision value)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user