Core 1.0
Public Member Functions | List of all members
BoxEmpty Class Reference

An axis aligned box, same as Box, but hollow. More...

#include <box.h>

Inheritance diagram for BoxEmpty:
Box

Public Member Functions

 BoxEmpty ()
 Empty.
 
 BoxEmpty (const Vector &, const Vector &)
 Create a box given two opposite corners. Note that this constructor does not check the coordinates of the two vectors. Therefore, the coordinates of a should be lower than those of b. More...
 
 BoxEmpty (const Vector &, const double &)
 Create a box given a center point and the half side length. More...
 
 BoxEmpty (const Box &)
 Create an empty box given a box. More...
 
 ~BoxEmpty ()
 Empty.
 
double R (const Vector &) const
 Computes the squared distance between the hollow-box and a point. More...
 
Vector Normal (const Vector &) const
 Computes the vector distance between the box and a point. More...
 
double Signed (const Vector &) const
 Computes the signed distance between the hollow-box and a point. More...
 
- Public Member Functions inherited from Box
 Box ()
 Empty.
 
 Box (const double &)
 Create a cube centered at the origin and of given half side length. More...
 
 Box (const Vector &)
 Create an empty box given one vertex. More...
 
 Box (const Vector &, const Vector &)
 Create a box given two opposite corners. More...
 
 Box (const Vector &, const double &)
 Create a box given a center point and the half side length. More...
 
 Box (const Vector &, const double &, const double &, const double &)
 Create a box given a center point and its width, length, and height. More...
 
 Box (const double &, const double &, const double &)
 Create a box given its sizes. More...
 
 Box (const Vector *, int)
 Creates the bounding box of a set of points. More...
 
 Box (const QVector< Vector > &)
 Creates the bounding box of a set of points. More...
 
 Box (const Box &, const Box &)
 Create a box embedding two boxes. More...
 
 Box (const Box &, const Frame &)
 Creates an axis aligned bounding box from a box and a frame. More...
 
 Box (const Box &, const FrameScaled &)
 Creates an axis aligned bounding box from a box and a frame. More...
 
 Box (const Box &, const Matrix &)
 Creates an axis aligned bounding box from a box and a transformation matrix. More...
 
 ~Box ()
 Empty.
 
Vectoroperator[] (int)
 Returns either end vertex of the box.
 
Vector operator[] (int) const
 Overloaded.
 
Vector Center () const
 Returns the center of the box.
 
Vector Vertex (int) const
 Returns the k-th vertex of the box. More...
 
Vector Vertex (int, int, int, int, int, int) const
 Compute the coordinates of a grid aligned point. More...
 
Segment Edge (int) const
 Compute the k-th edge segment of the box. More...
 
Plane Face (int) const
 Compute the k-th plane of the box. More...
 
Vector Size () const
 Compute the size (width, length and height) of a box. More...
 
Vector Diagonal () const
 Returns the diagonal of the box.
 
double Radius () const
 Returns the radius of the box, i.e. the length of the half diagonal of the box.
 
double R (const Vector &) const
 Computes the squared Euclidean distance between the box and a point. More...
 
double Signed (const Vector &) const
 Computes the signed distance between the box and a point. More...
 
Vector Normal (const Vector &) const
 Computes the normal vector between a point and a box. More...
 
double R (const Box &) const
 Compute the squared Euclidean distance between two boxes. More...
 
double RInfinity (const Box &) const
 Compute the maximum distance between two boxes. More...
 
int Intersect (const Ray &) const
 Check the intersection between a box and a ray. More...
 
int Intersect (const Ray &, double &, double &) const
 Computes the intersection between a box and a ray. More...
 
int Intersect (const Ray &, double &) const
 Compute the first positive intersection between the box and a ray. More...
 
int Intersect (const Ray &, double &, double &, Vector &, Vector &) const
 Compute the intersection between an axis aligned box and a ray. More...
 
int Intersect (const Ray &, double &, Vector &) const
 Compute the first positive intersection between the box and a ray. More...
 
int Intersect (const Vector &, const Vector &) const
 Check if a segment intersects an axis aligned box. More...
 
bool Intersect (const Box &) const
 Check if the box intersects another box. More...
 
bool Inside (const Box &) const
 Check if an argument box is inside the box. More...
 
bool Inside (const Vector &) const
 Check if a point is inside the box. More...
 
Box Intersection (const Box &) const
 Computes the intersection between two boxes. More...
 
int Difference (const Box &, Box *) const
 Computes the difference between two boxes. More...
 
bool Empty () const
 Check if a box is empty. More...
 
double Volume () const
 Compute the volume of a box.
 
double Area () const
 Compute the surface area of a box.
 
void SetCubic ()
 Creates the tightest embedding cube from an arbitrarilly shaped box. More...
 
void SetInscribedCubic ()
 Creates the biggest cube iscribed in the box. More...
 
Box Cube () const
 Return the tightest embedding cube from an arbitrarilly shaped box. More...
 
void Extend (const double &)
 Extend the limits of the box by a given distance. More...
 
Box Extended (const double &) const
 Extend the limits of the box by a given distance. More...
 
void Extend (const Vector &)
 Extend the limits of the box given a point. More...
 
void SetParallelepipedic (const double &, int &, int &, int &)
 Creates a parallelepipedic box whose dimensions are integer multiples of a given input reference size. More...
 
void SetParallelepipedic (int, int &, int &, int &)
 Inflates a box so that its dimensions should be a fraction of its maximum side length. More...
 
Box Sub (int) const
 Computes the sub-box in the n-th octant. More...
 
int Octant (const Vector &) const
 Compute the octant index of a vertex with respect to the box center. More...
 
void Translate (const Vector &)
 Translates a box. More...
 
Box Translated (const Vector &) const
 Translated box. More...
 
void Scale (const double &)
 Scales a box. More...
 
void Scale (const Vector &)
 Scales a box. More...
 
Box Scaled (const Vector &) const
 Scales a box and return the scaled box. More...
 
Box Offsetted (const Vector &) const
 Offets a box. More...
 
Box Centered () const
 Compute the box translated to origin. More...
 
Box Cut (const Vector &, const Vector &) const
 Compute the minimal box embedding the box cut by half space. More...
 
int IntegerAxis () const
 Compute the axis which has the greater length.
 
Vector RandomInside (Random &=Random::R239) const
 Generate a random vector inside the box. More...
 
Vector RandomSurface (Random &=Random::R239) const
 Generate a random vector on the surface of the box. More...
 
QVector< VectorPoisson (const double &, int, Random &=Random::R239) const
 Compute a Poisson sphere distribution inside a box. More...
 

Additional Inherited Members

- Static Public Attributes inherited from Box
static constexpr const double epsilon = 1.0e-5
 Epsilon value used to check intersections and some round off errors and for ray intersection tests.
 
static const Box Infinity
 Largest box. More...
 
static const Box Null
 Null box, equivalent to: More...
 
static const Box Unit
 Unit box.
 
static const int edge [24]
 Edge vertex indexes.
 
static const Vector normal [6]
 Face normals.
 
- Protected Attributes inherited from Box
Vector a
 Lower vertex.
 
Vector b
 Upper vertex.
 

Detailed Description

An axis aligned box, same as Box, but hollow.

The major difference with Box lies in the definition of the distance to the object.

Constructor & Destructor Documentation

◆ BoxEmpty() [1/3]

BoxEmpty::BoxEmpty ( const Vector a,
const Vector b 
)
explicit

Create a box given two opposite corners. Note that this constructor does not check the coordinates of the two vectors. Therefore, the coordinates of a should be lower than those of b.

To create the box given two vectors a and b in the general case, one should use:

An axis aligned box, same as Box, but hollow.
Definition: box.h:758
Vector b
Upper vertex.
Definition: box.h:26
Vector a
Lower vertex.
Definition: box.h:25
static Vector Min(const Vector &, const Vector &)
Return a vector with coordinates set to the minimum coordinates of the two argument vectors.
Definition: evector.h:521
double Max() const
Compute the maximum component of a vector.
Definition: evector.h:423
Parameters
a,bEnd vertices.

◆ BoxEmpty() [2/3]

BoxEmpty::BoxEmpty ( const Vector c,
const double &  r 
)
explicit

Create a box given a center point and the half side length.

Parameters
cCenter.
rHalf side length.

◆ BoxEmpty() [3/3]

BoxEmpty::BoxEmpty ( const Box box)
explicit

Create an empty box given a box.

Parameters
boxThe box.

Member Function Documentation

◆ Normal()

Vector BoxEmpty::Normal ( const Vector p) const

Computes the vector distance between the box and a point.

Parameters
pPoint.

◆ R()

double BoxEmpty::R ( const Vector p) const

Computes the squared distance between the hollow-box and a point.

Parameters
pPoint.

◆ Signed()

double BoxEmpty::Signed ( const Vector p) const

Computes the signed distance between the hollow-box and a point.

Note that the signed distance is always positive, and null on the box.

See also
BoxEmpty::R(const Vector&) const
Parameters
pPoint.