CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
Math::TConvexVolume< T > Struct Template Reference

Represents a convex volume defined by planes representing the volume border. More...

#include <CeresEngine/Math/Geometry.hpp>

Public Member Functions

 TConvexVolume ()=default
 
 TConvexVolume (SmallVector< TPlane< T >, 10 > planes)
 
 TConvexVolume (const TMatrix4< T > &projectionMatrix, bool useNearPlane=true)
 Creates frustum planes from the provided projection matrix.
 
void transform (const TMatrix4< T > &matrix)
 Transforms the convex volume by the given matrix.
 
void transform (const TTransform< T > &aTransform)
 Transforms the convex volume by the given matrix.
 
bool intersects (const TAABox< T > &box) const
 Checks does the volume intersects the provided axis aligned box.
 
bool intersects (const TSphere< T > &sphere) const
 Checks does the volume intersects the provided sphere.
 
TRayIntersection< T > intersects (const TRay< T > &ray) const
 Ray/convex volume intersection, returns boolean result and distance to nearest intersection.
 
bool contains (const TVector3< T > &p, T expand=0.0) const
 Checks if the convex volume contains the provided point.
 
const TPlane< T > & getPlane (FrustumPlane whichPlane) const
 Returns the specified plane that represents the volume.
 

Public Attributes

SmallVector< TPlane< T >, 10 > planes
 The set of planes that represent the volume.
 

Friends

TConvexVolume operator* (const TMatrix4< T > &lhs, TConvexVolume rhs)
 Transforms the convex volume by the given matrix.
 
TConvexVolume operator* (const TTransform< T > &lhs, TConvexVolume rhs)
 Transforms the convex volume by the given transform.
 

Detailed Description

template<typename T>
struct Math::TConvexVolume< T >

Represents a convex volume defined by planes representing the volume border.

Constructor & Destructor Documentation

◆ TConvexVolume() [1/3]

template<typename T >
Math::TConvexVolume< T >::TConvexVolume ( )
default

◆ TConvexVolume() [2/3]

template<typename T >
Math::TConvexVolume< T >::TConvexVolume ( SmallVector< TPlane< T >, 10 >  planes)
inlineexplicit

◆ TConvexVolume() [3/3]

template<typename T >
Math::TConvexVolume< T >::TConvexVolume ( const TMatrix4< T > &  projectionMatrix,
bool  useNearPlane = true 
)
explicit

Creates frustum planes from the provided projection matrix.

Member Function Documentation

◆ contains()

template<typename T >
bool Math::TConvexVolume< T >::contains ( const TVector3< T > &  p,
expand = 0.0 
) const

Checks if the convex volume contains the provided point.

Parameters
pPoint to check.
expandOptional value to expand the size of the convex volume by the specified value during the check. Negative values shrink the volume.

◆ getPlane()

template<typename T >
const TPlane< T > & Math::TConvexVolume< T >::getPlane ( FrustumPlane  whichPlane) const

Returns the specified plane that represents the volume.

◆ intersects() [1/3]

template<typename T >
bool Math::TConvexVolume< T >::intersects ( const TAABox< T > &  box) const

Checks does the volume intersects the provided axis aligned box.

This will return true if the box is fully inside the volume.

◆ intersects() [2/3]

template<typename T >
TRayIntersection< T > Math::TConvexVolume< T >::intersects ( const TRay< T > &  ray) const

Ray/convex volume intersection, returns boolean result and distance to nearest intersection.

Parameters
rayRay to intersect with the sphere.

◆ intersects() [3/3]

template<typename T >
bool Math::TConvexVolume< T >::intersects ( const TSphere< T > &  sphere) const

Checks does the volume intersects the provided sphere.

This will return true if the sphere is fully inside the volume.

◆ transform() [1/2]

template<typename T >
void Math::TConvexVolume< T >::transform ( const TMatrix4< T > &  matrix)

Transforms the convex volume by the given matrix.

◆ transform() [2/2]

template<typename T >
void Math::TConvexVolume< T >::transform ( const TTransform< T > &  aTransform)
inline

Transforms the convex volume by the given matrix.

Friends And Related Symbol Documentation

◆ operator* [1/2]

template<typename T >
TConvexVolume operator* ( const TMatrix4< T > &  lhs,
TConvexVolume< T >  rhs 
)
friend

Transforms the convex volume by the given matrix.

◆ operator* [2/2]

template<typename T >
TConvexVolume operator* ( const TTransform< T > &  lhs,
TConvexVolume< T >  rhs 
)
friend

Transforms the convex volume by the given transform.

Member Data Documentation

◆ planes

template<typename T >
SmallVector<TPlane<T>, 10> Math::TConvexVolume< T >::planes

The set of planes that represent the volume.


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