3Depict
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | Friends | List of all members
BoundCube Class Reference

A helper class to define a bounding cube. More...

#include <basics.h>

Public Member Functions

 BoundCube ()
 
 BoundCube (const Point3D &p1, const Point3D &p2)
 
void setBounds (float xMin, float yMin, float zMin, float xMax, float yMax, float zMax)
 
void setBounds (const BoundCube &b)
 
void setInvalid ()
 
void setInverseLimits (bool setAsValid=false)
 
void setBound (unsigned int bound, unsigned int minMax, float value)
 
float getBound (unsigned int bound, unsigned int minMax) const
 
void getBound (Point3D &bound, unsigned int minMax) const
 
Point3D getCentroid () const
 Return the centroid. More...
 
void getBounds (Point3D &low, Point3D &high) const
 Get the bounds. More...
 
float getSize (unsigned int dim) const
 Return the side length of the cube along the specified dimension. More...
 
bool isValid () const
 Returns true if all bounds are valid. More...
 
bool isFlat () const
 Returns true if any bound is of null thickness. More...
 
bool isNumericallyBig () const
 Returns true if any bound of datacube is considered to be "large" in magnitude compared to. More...
 
void setBounds (const Point3D *ptArray, unsigned int nPoints)
 Obtain bounds from an array of Point3Ds. More...
 
void setBounds (const Point3D &p, const Point3D &q)
 Use two points to set bounds – does not need to be high,low. this is worked out/. More...
 
void setBounds (const std::vector< Point3D > &ptArray)
 Obtain bounds from an array of Point3Ds. More...
 
void setBounds (const Point3D &p, float radius)
 Set bounds via cube that contains given sphere. More...
 
bool intersects (const Point3D &pt, float sqrRad) const
 Checks if a point intersects a sphere of centre Pt, radius^2 sqrRad. More...
 
BoundCube makeUnion (const BoundCube &b) const
 
bool containsPt (const Point3D &pt) const
 
bool contains (const BoundCube &b) const
 
bool containedInSphere (const Point3D &pt, float sqrRad) const
 Is this bounding cube completely contained within a sphere centred on pt of sqr size sqrRad? More...
 
unsigned int segmentTriple (unsigned int dim, float slice) const
 
float getMaxDistanceToBox (const Point3D &pt) const
 Returns maximum distnace to box corners (which is an upper bound on max box distance). More...
 
float getLargestDim () const
 
float volume () const
 
void limits ()
 
const BoundCubeoperator= (const BoundCube &)
 
void expand (const BoundCube &b)
 Expand (as needed) volume such that the argument bounding cube is enclosed by this one. More...
 
void expand (const Point3D &p)
 Expand such that point is contained in this volume. Existing volume must be valid. More...
 
void expand (float v)
 Expand by a specified thickness. More...
 
Point3D getVertex (unsigned int idx) const
 Obtain a corner point of the cube. More...
 
void getVertices (std::vector< Point3D > &p, bool centre=false) const
 Obtain the corner points of the cube. More...
 
void getPlaneIntersectVertices (const Point3D &planeOrigin, const Point3D &normal, std::vector< Point3D > &intersectPts) const
 Obtain the vertices that arise from the intersection of a plane with the cube. More...
 

Friends

class K3DTree
 
class K3DTreeMk2
 
std::ostream & operator<< (std::ostream &stream, const BoundCube &b)
 

Detailed Description

A helper class to define a bounding cube.

Constructor & Destructor Documentation

◆ BoundCube() [1/2]

BoundCube::BoundCube ( )
inline

◆ BoundCube() [2/2]

BoundCube::BoundCube ( const Point3D p1,
const Point3D p2 
)

Member Function Documentation

◆ containedInSphere()

bool BoundCube::containedInSphere ( const Point3D pt,
float  sqrRad 
) const

Is this bounding cube completely contained within a sphere centred on pt of sqr size sqrRad?

References ASSERT, and Point3D::sqrDist().

Referenced by K3DTreeMk2::getTreesInSphere(), and K3DTreeMk2::ptsInSphere().

Here is the caller graph for this function:

◆ contains()

bool BoundCube::contains ( const BoundCube b) const

References getBounds().

Referenced by K3DTreeMk2::getBoxInTree().

Here is the caller graph for this function:

◆ containsPt()

bool BoundCube::containsPt ( const Point3D pt) const

◆ expand() [1/3]

void BoundCube::expand ( const BoundCube b)

◆ expand() [2/3]

void BoundCube::expand ( const Point3D p)

Expand such that point is contained in this volume. Existing volume must be valid.

◆ expand() [3/3]

void BoundCube::expand ( float  v)

Expand by a specified thickness.

◆ getBound() [1/2]

float BoundCube::getBound ( unsigned int  bound,
unsigned int  minMax 
) const

◆ getBound() [2/2]

void BoundCube::getBound ( Point3D bound,
unsigned int  minMax 
) const

◆ getBounds()

void BoundCube::getBounds ( Point3D low,
Point3D high 
) const

◆ getCentroid()

Point3D BoundCube::getCentroid ( ) const

◆ getLargestDim()

float BoundCube::getLargestDim ( ) const

Referenced by Scene::draw().

Here is the caller graph for this function:

◆ getMaxDistanceToBox()

float BoundCube::getMaxDistanceToBox ( const Point3D pt) const

Returns maximum distnace to box corners (which is an upper bound on max box distance).

References ASSERT, and Point3D::sqrDist().

Referenced by CameraLookAt::apply(), and BasicGLPane::saveImage().

Here is the caller graph for this function:

◆ getPlaneIntersectVertices()

void BoundCube::getPlaneIntersectVertices ( const Point3D planeOrigin,
const Point3D normal,
std::vector< Point3D > &  intersectPts 
) const

Obtain the vertices that arise from the intersection of a plane with the cube.

References ASSERT, Point3D::centroid(), clockwiseAngle(), Point3D::normalise(), and vectorMultiErase().

Referenced by VoxeliseFilter::refresh(), and rmFile().

Here is the caller graph for this function:

◆ getSize()

float BoundCube::getSize ( unsigned int  dim) const

Return the side length of the cube along the specified dimension.

References ASSERT.

Referenced by countBinnedIons(), and CameraLookAt::ensureVisible().

Here is the caller graph for this function:

◆ getVertex()

Point3D BoundCube::getVertex ( unsigned int  idx) const

Obtain a corner point of the cube.

References ASSERT.

◆ getVertices()

void BoundCube::getVertices ( std::vector< Point3D > &  p,
bool  centre = false 
) const

Obtain the corner points of the cube.

Referenced by DrawGLText::getBoundingBox().

Here is the caller graph for this function:

◆ intersects()

bool BoundCube::intersects ( const Point3D pt,
float  sqrRad 
) const

Checks if a point intersects a sphere of centre Pt, radius^2 sqrRad.

References Point3D::getValue(), Point3D::setValue(), and Point3D::sqrDist().

Referenced by K3DTree::findNearest(), K3DTreeMk2::findNearestUntagged(), K3DTreeMk2::findNearestWithSkip(), K3DTreeMk2::getTreesInSphere(), and K3DTreeMk2::ptsInSphere().

Here is the caller graph for this function:

◆ isFlat()

bool BoundCube::isFlat ( ) const

Returns true if any bound is of null thickness.

Referenced by VoxeliseFilter::refresh().

Here is the caller graph for this function:

◆ isNumericallyBig()

bool BoundCube::isNumericallyBig ( ) const

Returns true if any bound of datacube is considered to be "large" in magnitude compared to.

Referenced by DataLoadFilter::refresh().

Here is the caller graph for this function:

◆ isValid()

bool BoundCube::isValid ( ) const

◆ limits()

void BoundCube::limits ( )

◆ makeUnion()

BoundCube BoundCube::makeUnion ( const BoundCube b) const

References ColourRGBA::a(), ColourRGBA::b(), and setBound().

Referenced by K3DTreeMk2::getBoxInTree().

Here is the caller graph for this function:

◆ operator=()

const BoundCube & BoundCube::operator= ( const BoundCube b)

◆ segmentTriple()

unsigned int BoundCube::segmentTriple ( unsigned int  dim,
float  slice 
) const

References ASSERT.

Referenced by K3DTreeMk2::getBoxInTree().

Here is the caller graph for this function:

◆ setBound()

void BoundCube::setBound ( unsigned int  bound,
unsigned int  minMax,
float  value 
)

References ASSERT.

Referenced by IonHit::getBoundCube(), DrawSphere::getBoundingBox(), K3DTreeMk2::getBoxInTree(), and makeUnion().

Here is the caller graph for this function:

◆ setBounds() [1/6]

void BoundCube::setBounds ( float  xMin,
float  yMin,
float  zMin,
float  xMax,
float  yMax,
float  zMax 
)
inline

◆ setBounds() [2/6]

void BoundCube::setBounds ( const BoundCube b)
inline

◆ setBounds() [3/6]

void BoundCube::setBounds ( const Point3D ptArray,
unsigned int  nPoints 
)

Obtain bounds from an array of Point3Ds.

◆ setBounds() [4/6]

void BoundCube::setBounds ( const Point3D p,
const Point3D q 
)

Use two points to set bounds – does not need to be high,low. this is worked out/.

◆ setBounds() [5/6]

void BoundCube::setBounds ( const std::vector< Point3D > &  ptArray)

Obtain bounds from an array of Point3Ds.

References ASSERT.

◆ setBounds() [6/6]

void BoundCube::setBounds ( const Point3D p,
float  radius 
)

Set bounds via cube that contains given sphere.

References ColourRGBA::r().

◆ setInvalid()

void BoundCube::setInvalid ( )
inline

◆ setInverseLimits()

void BoundCube::setInverseLimits ( bool  setAsValid = false)

◆ volume()

float BoundCube::volume ( ) const
inline

References operator<<().

Referenced by countBinnedIons(), IonInfoFilter::refresh(), and TransformFilter::setPropFromBinding().

Here is the caller graph for this function:

Friends And Related Function Documentation

◆ K3DTree

friend class K3DTree
friend

◆ K3DTreeMk2

friend class K3DTreeMk2
friend

◆ operator<<

std::ostream& operator<< ( std::ostream &  stream,
const BoundCube b 
)
friend

The documentation for this class was generated from the following files: