Cuboid_3D
-
template<typename F>
struct HPS::Cuboid_3D Public Functions
- inline HPS_INLINE bool Contains (Cuboid_3D const &contained) const
Returns true if the cuboid completely contains the parameter cuboid.
- Parameters
contained – The other cuboid
- inline HPS_INLINE bool Contains (Point_3D< F > const &contained) const
Returns true if the cuboid completely contains a cuboid based on the parameter points.
- Parameters
contained – The points to compare against
- inline HPS_INLINE bool Contains (Point_3D< F > const &contained, F epsilon) const
Returns true if the cuboid completely contains a cuboid based on the parameter points, with a tolerance value.
- Parameters
contained – The points to compare against
epsilon – The tolerance value
- inline HPS_INLINE Cuboid_3D & Contract (F border)
Contracts both corners of this cuboid.
- Parameters
border – Amount to contract
-
inline Cuboid_3D()
Creates an invalid cuboid.
-
template<typename D>
inline explicit Cuboid_3D(Cuboid_3D<D> const &that) Creates a cuboid equal to another cuboid.
- Parameters
that – The other cuboid
-
inline Cuboid_3D(Point_3D<F> const &in_min, Point_3D<F> const &in_max)
Creates a cuboid based on two points, which become opposite corners of the cuboid.
- Parameters
in_min – The first point of the cuboid
in_max – The second point of the cuboid
-
inline Cuboid_3D(Rectangle const &that)
Creates a cuboid with the same dimensions as a rectangle.
- Parameters
that – The rectangle to create the cuboid from
-
inline Cuboid_3D(size_t count, Point_3D<F> const *points)
Creates a cuboid based on an array of points. Only the minimum and maximum points are used, which become opposite corners of the cuboid. If count is 0, then an invalid cuboid is returned.
- Parameters
count – The size of points
points – An array of points
-
template<typename T>
inline Cuboid_3D(size_t count, T const *indices, Point_3D<F> const *points) Creates a cuboid based on an array of points. Only the minimum and maximum points are used, which become opposite corners of the cuboid. If count is 0, then an invalid cuboid is returned.
- Parameters
count – The number of index values in indices
indices – the index values used to select points
points – An array of points
-
Cuboid_3D(Sphere_3D<F> const &that)
Creates a cuboid that will fit tightly around a sphere.
- Parameters
that – The sphere to fit
- inline HPS_INLINE Vector_3D< F > Diagonal () const
Returns the diagonal vector of the cuboid.
- inline HPS_INLINE Cuboid_3D & Expand (F border)
Expands both corners of this cuboid.
- Parameters
border – Amount to expand
- inline HPS_INLINE void Generate_Cuboid_Points (Point_3D< F > *points) const
Assigns the eight corners of the cuboid based on the points in the parameter array. The array must contain at least eight points.
- Parameters
points – The array which contains points
- inline HPS_INLINE Cuboid_3D & Intersect (Cuboid_3D const &cuboid)
Replaces this cuboid with the intersection of this cuboid and the parameter cuboid.
- Parameters
cuboid – The cuboid to compute intersection against
- inline HPS_INLINE bool Intersecting (Cuboid_3D const &cuboid) const
Determines whether this cuboid intersects with another cuboid.
- Parameters
cuboid – The other cuboid
- inline HPS_INLINE bool Intersecting (Cuboid_3D const &cuboid, F const allowance) const
Determines whether this cuboid intersects with another cuboid. Allows for a tolerance value to be considered.
- Parameters
cuboid – The other cuboid
- inline HPS_INLINE bool Intersecting (int dimension, Cuboid_3D const &cuboid) const
Returns true if this cuboid intersects with the parameter cuboid along a certain axis.
- Parameters
dimension – Must be either 0, 1, or 2. Corresponds to the X, Y, and Z axes.
cuboid – The cuboid to test against
- inline HPS_INLINE bool Intersecting (int dimension, Cuboid_3D const &cuboid, F const allowance) const
Returns true if this cuboid intersects with the parameter cuboid along a certain axis, and considers a tolerance value.
- Parameters
dimension – Must be 0, 1, or 2. Corresponds to the X, Y, and Z axes.
cuboid – The cuboid to test against
allowance – The tolerance value
- inline HPS_INLINE bool Intersecting (Point_3D< F > const &point1, Point_3D< F > const &point2) const
Determines whether this cuboid intersects with an infinite line.
- Parameters
point1 – A point on the line.
point2 – A different point on the line.
- inline HPS_INLINE bool Intersecting (Point_3D< F > const &start, Vector_3D< F > const &direction) const
Determines whether this cuboid intersects with a ray.
- Parameters
start – The start point of the ray.
direction – The direction of the ray.
-
inline void Invalidate()
Invalidates this cuboid.
- inline HPS_INLINE bool IsValid () const
Tests whether this cuboid is valid. The cuboid is considered valid if the minimum point is less than or equal to the maximum point.
- inline HPS_INLINE void Merge (Cuboid_3D const &cuboid)
Merges this cuboid with another cuboid. Only the smallest and largest values of the cuboids are retained.
- Parameters
cuboid – The other cuboid
- inline HPS_INLINE void Merge (Point_3D< F > const &point)
Expands the cuboid to include a point.
- Parameters
point – The point to include
-
inline void Merge(size_t count, Point_3D<F> const *points)
Expands this cuboid to include a set of points.
- Parameters
count – The number of points in points
points – The array of points
-
template<typename T>
inline void Merge(size_t count, T const *indices, Point_3D<F> const *points) Expands this cuboid to include a set of indexed points.
- Parameters
count – The number of index values in indices
indices – the index values used to select points
points – The array of points
- inline HPS_INLINE void Merge (Sphere_3D< F > const &sphere)
Merges this cuboid with another cuboid created from a sphere. Only the smallest and largest values of the cuboids are retained.
- Parameters
cuboid – The other cuboid
- inline HPS_INLINE bool operator!= (Cuboid_3D const &cuboid) const
Determines if the maximum and minimum points of this cuboid are not equal to the maximum and minimum points of another cuboid.
- Parameters
cuboid – The other cuboid
- inline HPS_INLINE bool operator== (Cuboid_3D const &cuboid) const
Determines if the maximum and minimum points of this cuboid are equal to the maximum and minimum points of another cuboid.
- Parameters
cuboid – The other cuboid
- inline HPS_INLINE Cuboid_3D & Union (Cuboid_3D const &cuboid)
Replaces this cuboid with the union of this cuboid and the parameter cuboid.
- Parameters
cuboid – The cuboid to compute union against
- inline HPS_INLINE F Volume () const
Returns the volume of this cuboid.
Public Members
Public Static Functions
- static inline HPS_INLINE Cuboid_3D Invalid ()
Creates an invalid cuboid.