Hoops Visualize HPS  version 2018-SP2
Hoops Visualize HPS 3D Rendering Engine
Looking for a senior C++ dev?
I'm looking for work. Hire me!
HPS::Cuboid_3D< F > Struct Template Reference

#include <hps.h>

Inheritance diagram for HPS::Cuboid_3D< F >:
Collaboration diagram for HPS::Cuboid_3D< F >:

Public Member Functions

 Cuboid_3D ()
 Creates an invalid cuboid. More...
 
template<typename D >
 Cuboid_3D (Cuboid_3D< D > const &that)
 Creates a cuboid equal to another cuboid. More...
 
 Cuboid_3D (Sphere_3D< F > const &that)
 Creates a cuboid that will fit tightly around a sphere. More...
 
 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. More...
 
 Cuboid_3D (size_t count, Point_3D< F > const *points)
 Creates a cuboid based on an array of points. More...
 
template<typename T >
 Cuboid_3D (size_t count, T const *indices, Point_3D< F > const *points)
 Creates a cuboid based on an array of points. More...
 
 Cuboid_3D (Rectangle const &that)
 Creates a cuboid with the same dimensions as a rectangle. More...
 
HPS_INLINE bool IsValid () const
 Tests whether this cuboid is valid. More...
 
void Invalidate ()
 Invalidates this cuboid. More...
 
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. More...
 
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. More...
 
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. More...
 
HPS_INLINE Vector_3D< FDiagonal () const
 Returns the diagonal vector of the cuboid. More...
 
HPS_INLINE F Volume () const
 Returns the volume of this cuboid. More...
 
HPS_INLINE bool Intersecting (Cuboid_3D const &cuboid) const
 Determines whether this cuboid intersects with another cuboid. More...
 
HPS_INLINE bool Intersecting (Cuboid_3D const &cuboid, F const allowance) const
 Determines whether this cuboid intersects with another cuboid. More...
 
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. More...
 
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. More...
 
HPS_INLINE bool Intersecting (Point_3D< F > const &start, Vector_3D< F > const &direction) const
 Determines whether this cuboid intersects with a ray. More...
 
HPS_INLINE bool Intersecting (Point_3D< F > const &point1, Point_3D< F > const &point2) const
 Determines whether this cuboid intersects with an infinite line. More...
 
HPS_INLINE void Merge (Cuboid_3D const &cuboid)
 Merges this cuboid with another cuboid. More...
 
HPS_INLINE void Merge (Sphere_3D< F > const &sphere)
 Merges this cuboid with another cuboid created from a sphere. More...
 
HPS_INLINE void Merge (Point_3D< F > const &point)
 Expands the cuboid to include a point. More...
 
void Merge (size_t count, Point_3D< F > const *points)
 Expands this cuboid to include a set of points. More...
 
template<typename T >
void Merge (size_t count, T const *indices, Point_3D< F > const *points)
 Expands this cuboid to include a set of indexed points. More...
 
HPS_INLINE bool Contains (Cuboid_3D const &contained) const
 Returns true if the cuboid completely contains the parameter cuboid. More...
 
HPS_INLINE bool Contains (Point_3D< F > const &contained) const
 Returns true if the cuboid completely contains a cuboid based on the parameter points. More...
 
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. More...
 
HPS_INLINE Cuboid_3DIntersect (Cuboid_3D const &cuboid)
 Replaces this cuboid with the intersection of this cuboid and the parameter cuboid. More...
 
HPS_INLINE Cuboid_3DUnion (Cuboid_3D const &cuboid)
 Replaces this cuboid with the union of this cuboid and the parameter cuboid. More...
 
HPS_INLINE Cuboid_3DExpand (F border)
 Expands both corners of this cuboid. More...
 
HPS_INLINE Cuboid_3DContract (F border)
 Contracts both corners of this cuboid. More...
 

Static Public Member Functions

static HPS_INLINE Cuboid_3D Invalid ()
 Creates an invalid cuboid. More...
 

Public Attributes

Point_3D< Fmin
 The minimum point of this cuboid. More...
 
Point_3D< Fmax
 The maximum point of this cuboid. More...
 

Private Member Functions

void merge2 (Point_3D< F > const &p1, Point_3D< F > const &p2)
 
bool LineIntersecting (Point_3D< F > const &start, Vector_3D< F > const &direction, bool is_ray) const
 

Static Private Member Functions

static HPS_INLINE Point_3D< FLimit_Point ()
 

Constructor & Destructor Documentation

◆ Cuboid_3D() [1/7]

template<typename F>
HPS::Cuboid_3D< F >::Cuboid_3D ( )
inline

Creates an invalid cuboid.

◆ Cuboid_3D() [2/7]

template<typename F>
template<typename D >
HPS::Cuboid_3D< F >::Cuboid_3D ( Cuboid_3D< D > const &  that)
inlineexplicit

Creates a cuboid equal to another cuboid.

Parameters
thatThe other cuboid

◆ Cuboid_3D() [3/7]

template<typename F>
HPS_INLINE HPS::Cuboid_3D< F >::Cuboid_3D ( Sphere_3D< F > const &  that)

Creates a cuboid that will fit tightly around a sphere.

Parameters
thatThe sphere to fit

◆ Cuboid_3D() [4/7]

template<typename F>
HPS::Cuboid_3D< F >::Cuboid_3D ( Point_3D< F > const &  in_min,
Point_3D< F > const &  in_max 
)
inline

Creates a cuboid based on two points, which become opposite corners of the cuboid.

Parameters
in_minThe first point of the cuboid
in_maxThe second point of the cuboid

◆ Cuboid_3D() [5/7]

template<typename F>
HPS::Cuboid_3D< F >::Cuboid_3D ( size_t  count,
Point_3D< F > const *  points 
)
inline

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
countThe size of points
pointsAn array of points

◆ Cuboid_3D() [6/7]

template<typename F>
template<typename T >
HPS::Cuboid_3D< F >::Cuboid_3D ( size_t  count,
T const *  indices,
Point_3D< F > const *  points 
)
inline

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
countThe number of index values in indices
indicesthe index values used to select points
pointsAn array of points

◆ Cuboid_3D() [7/7]

template<typename F>
HPS::Cuboid_3D< F >::Cuboid_3D ( Rectangle const &  that)
inline

Creates a cuboid with the same dimensions as a rectangle.

Parameters
thatThe rectangle to create the cuboid from

Member Function Documentation

◆ Contains() [1/3]

template<typename F>
HPS_INLINE bool HPS::Cuboid_3D< F >::Contains ( Cuboid_3D< F > const &  contained) const
inline

Returns true if the cuboid completely contains the parameter cuboid.

Parameters
containedThe other cuboid

◆ Contains() [2/3]

template<typename F>
HPS_INLINE bool HPS::Cuboid_3D< F >::Contains ( Point_3D< F > const &  contained) const
inline

Returns true if the cuboid completely contains a cuboid based on the parameter points.

Parameters
containedThe points to compare against

◆ Contains() [3/3]

template<typename F>
HPS_INLINE bool HPS::Cuboid_3D< F >::Contains ( Point_3D< F > const &  contained,
F  epsilon 
) const
inline

Returns true if the cuboid completely contains a cuboid based on the parameter points, with a tolerance value.

Parameters
containedThe points to compare against
epsilonThe tolerance value

◆ Contract()

template<typename F>
HPS_INLINE Cuboid_3D& HPS::Cuboid_3D< F >::Contract ( F  border)
inline

Contracts both corners of this cuboid.

Parameters
borderAmount to contract
Here is the caller graph for this function:

◆ Diagonal()

template<typename F>
HPS_INLINE Vector_3D<F> HPS::Cuboid_3D< F >::Diagonal ( ) const
inline

Returns the diagonal vector of the cuboid.

Here is the caller graph for this function:

◆ Expand()

template<typename F>
HPS_INLINE Cuboid_3D& HPS::Cuboid_3D< F >::Expand ( F  border)
inline

Expands both corners of this cuboid.

Parameters
borderAmount to expand
Here is the caller graph for this function:

◆ Generate_Cuboid_Points()

template<typename F>
HPS_INLINE void HPS::Cuboid_3D< F >::Generate_Cuboid_Points ( Point_3D< F > *  points) const
inline

Assigns the eight corners of the cuboid based on the points in the parameter array.

The array must contain at least eight points.

Parameters
pointsThe array which contains points
Here is the caller graph for this function:

◆ Intersect()

template<typename F>
HPS_INLINE Cuboid_3D& HPS::Cuboid_3D< F >::Intersect ( Cuboid_3D< F > const &  cuboid)
inline

Replaces this cuboid with the intersection of this cuboid and the parameter cuboid.

Parameters
cuboidThe cuboid to compute intersection against
Here is the caller graph for this function:

◆ Intersecting() [1/6]

template<typename F>
HPS_INLINE bool HPS::Cuboid_3D< F >::Intersecting ( Cuboid_3D< F > const &  cuboid) const
inline

Determines whether this cuboid intersects with another cuboid.

Parameters
cuboidThe other cuboid

◆ Intersecting() [2/6]

template<typename F>
HPS_INLINE bool HPS::Cuboid_3D< F >::Intersecting ( Cuboid_3D< F > const &  cuboid,
F const  allowance 
) const
inline

Determines whether this cuboid intersects with another cuboid.

Allows for a tolerance value to be considered.

Parameters
cuboidThe other cuboid

◆ Intersecting() [3/6]

template<typename F>
HPS_INLINE bool HPS::Cuboid_3D< F >::Intersecting ( int  dimension,
Cuboid_3D< F > const &  cuboid 
) const
inline

Returns true if this cuboid intersects with the parameter cuboid along a certain axis.

Parameters
dimensionMust be either 0, 1, or 2. Corresponds to the X, Y, and Z axes.
cuboidThe cuboid to test against

◆ Intersecting() [4/6]

template<typename F>
HPS_INLINE bool HPS::Cuboid_3D< F >::Intersecting ( int  dimension,
Cuboid_3D< F > const &  cuboid,
F const  allowance 
) const
inline

Returns true if this cuboid intersects with the parameter cuboid along a certain axis, and considers a tolerance value.

Parameters
dimensionMust be 0, 1, or 2. Corresponds to the X, Y, and Z axes.
cuboidThe cuboid to test against
allowanceThe tolerance value

◆ Intersecting() [5/6]

template<typename F>
HPS_INLINE bool HPS::Cuboid_3D< F >::Intersecting ( Point_3D< F > const &  start,
Vector_3D< F > const &  direction 
) const
inline

Determines whether this cuboid intersects with a ray.

Parameters
startThe start point of the ray.
directionThe direction of the ray.

◆ Intersecting() [6/6]

template<typename F>
HPS_INLINE bool HPS::Cuboid_3D< F >::Intersecting ( Point_3D< F > const &  point1,
Point_3D< F > const &  point2 
) const
inline

Determines whether this cuboid intersects with an infinite line.

Parameters
point1A point on the line.
point2A different point on the line.

◆ Invalid()

template<typename F>
static HPS_INLINE Cuboid_3D HPS::Cuboid_3D< F >::Invalid ( )
inlinestatic

Creates an invalid cuboid.

◆ Invalidate()

template<typename F>
void HPS::Cuboid_3D< F >::Invalidate ( )
inline

Invalidates this cuboid.

◆ IsValid()

template<typename F>
HPS_INLINE bool HPS::Cuboid_3D< F >::IsValid ( ) const
inline

Tests whether this cuboid is valid.

The cuboid is considered valid if the minimum point is less than or equal to the maximum point.

◆ Limit_Point()

template<typename F>
static HPS_INLINE Point_3D<F> HPS::Cuboid_3D< F >::Limit_Point ( )
inlinestaticprivate

◆ LineIntersecting()

template<typename F>
bool HPS::Cuboid_3D< F >::LineIntersecting ( Point_3D< F > const &  start,
Vector_3D< F > const &  direction,
bool  is_ray 
) const
private

◆ Merge() [1/5]

template<typename F>
HPS_INLINE void HPS::Cuboid_3D< F >::Merge ( Cuboid_3D< F > const &  cuboid)
inline

Merges this cuboid with another cuboid.

Only the smallest and largest values of the cuboids are retained.

Parameters
cuboidThe other cuboid

◆ Merge() [2/5]

template<typename F>
HPS_INLINE void HPS::Cuboid_3D< F >::Merge ( Sphere_3D< F > const &  sphere)
inline

Merges this cuboid with another cuboid created from a sphere.

Only the smallest and largest values of the cuboids are retained.

Parameters
cuboidThe other cuboid
Here is the caller graph for this function:

◆ Merge() [3/5]

template<typename F>
HPS_INLINE void HPS::Cuboid_3D< F >::Merge ( Point_3D< F > const &  point)
inline

Expands the cuboid to include a point.

Parameters
pointThe point to include

◆ Merge() [4/5]

template<typename F>
void HPS::Cuboid_3D< F >::Merge ( size_t  count,
Point_3D< F > const *  points 
)
inline

Expands this cuboid to include a set of points.

Parameters
countThe number of points in points
pointsThe array of points

◆ Merge() [5/5]

template<typename F>
template<typename T >
void HPS::Cuboid_3D< F >::Merge ( size_t  count,
T const *  indices,
Point_3D< F > const *  points 
)
inline

Expands this cuboid to include a set of indexed points.

Parameters
countThe number of index values in indices
indicesthe index values used to select points
pointsThe array of points

◆ merge2()

template<typename F>
void HPS::Cuboid_3D< F >::merge2 ( Point_3D< F > const &  p1,
Point_3D< F > const &  p2 
)
inlineprivate

◆ operator!=()

template<typename F>
HPS_INLINE bool HPS::Cuboid_3D< F >::operator!= ( Cuboid_3D< F > const &  cuboid) const
inline

Determines if the maximum and minimum points of this cuboid are not equal to the maximum and minimum points of another cuboid.

Parameters
cuboidThe other cuboid

◆ operator==()

template<typename F>
HPS_INLINE bool HPS::Cuboid_3D< F >::operator== ( Cuboid_3D< F > const &  cuboid) const
inline

Determines if the maximum and minimum points of this cuboid are equal to the maximum and minimum points of another cuboid.

Parameters
cuboidThe other cuboid

◆ Union()

template<typename F>
HPS_INLINE Cuboid_3D& HPS::Cuboid_3D< F >::Union ( Cuboid_3D< F > const &  cuboid)
inline

Replaces this cuboid with the union of this cuboid and the parameter cuboid.

Parameters
cuboidThe cuboid to compute union against
Here is the caller graph for this function:

◆ Volume()

template<typename F>
HPS_INLINE F HPS::Cuboid_3D< F >::Volume ( ) const
inline

Returns the volume of this cuboid.

Member Data Documentation

◆ max

template<typename F>
Point_3D<F> HPS::Cuboid_3D< F >::max

The maximum point of this cuboid.

◆ min

template<typename F>
Point_3D<F> HPS::Cuboid_3D< F >::min

The minimum point of this cuboid.


The documentation for this struct was generated from the following file: