ActiveLib
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | List of all members
active::geometry::Box Class Reference

#include <Box.h>

Collaboration diagram for active::geometry::Box:
Collaboration graph
[legend]

Public Types

using Unique = std::unique_ptr<Box>
 Unique pointer.
 
using Shared = std::shared_ptr<Box>
 Shared pointer.
 
using Option = std::optional<Box>
 Optional.
 

Public Member Functions

 Box ()
 
 Box (const Point &origin, const Point &end)
 
 Box (double x1, double y1, double z1, double x2, double y2, double z2)
 
 Box (double width, double depth)
 
 ~Box ()
 
bool operator== (const Box &ref) const
 
bool operator!= (const Box &ref) const
 
Boxoperator= (const Box &source)
 
Box operator+ (const Point &offset) const
 
Boxoperator+= (const Point &offset)
 
Box operator- (const Point &offset) const
 
Boxoperator-= (const Point &offset)
 
Box operator* (double scale) const
 
Boxoperator*= (double scale)
 
Box operator/ (double scale) const
 
Boxoperator/= (double scale)
 
bool isEqual2D (const Box &ref, double prec=math::eps) const
 
bool isEqual3D (const Box &ref, double prec=math::eps) const
 
Point getCentre () const
 
Point getAnchor2D (Anchor2D anchor) const
 
double getArea () const
 
double getVolume () const
 
double getWidth () const
 
double getDepth () const
 
double getHeight () const
 
double getMaxLength () const
 
Position positionOf2D (const Point &ref, double prec=math::eps) const
 
Position positionOf3D (const Point &ref, double prec=math::eps) const
 
bool encloses2D (const Box &ref, double prec=math::eps) const
 
bool encloses3D (const Box &ref, double prec=math::eps) const
 
bool overlaps2D (const Box &ref, double prec=math::eps) const
 
void moveTo (const Point &position)
 
void setCentre (const Point &centre)
 
void merge (const Point &ref)
 
void merge (const Box &ref)
 
void sort ()
 
void magnify (double scale)
 
void resize (double len)
 
void rotate (double angle)
 

Public Attributes

Point origin
 Box origin (for diagonally opposite points)
 
Point end
 Box end.
 

Detailed Description

Class to represent a box (rectilinear bounds in 3 dimensions described by 2 diagonally opposite points)

Constructor & Destructor Documentation

◆ Box() [1/4]

active::geometry::Box::Box ( )
inline

Constructor

Here is the caller graph for this function:

◆ Box() [2/4]

active::geometry::Box::Box ( const Point & origin,
const Point & end )
inline

Constructor

Parameters
originOne corner of the box
endThe opposite corner of the box

◆ Box() [3/4]

active::geometry::Box::Box ( double x1,
double y1,
double z1,
double x2,
double y2,
double z2 )
inline

Constructor

Parameters
x1Bounding coordinates of the box

◆ Box() [4/4]

active::geometry::Box::Box ( double width,
double depth )
inline

Constructor

Parameters
widthThe box width
depthThe box depth

◆ ~Box()

active::geometry::Box::~Box ( )
inline

Destructor

Member Function Documentation

◆ encloses2D()

bool Box::encloses2D ( const Box & ref,
double prec = math::eps ) const

Determine if the this encloses a specified box in 2D

Parameters
refThe reference box
precThe required precision
Returns
True if the box is enclosed by this (in or along)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ encloses3D()

bool Box::encloses3D ( const Box & ref,
double prec = math::eps ) const

Determine if the this encloses a specified box in 3D

Parameters
refThe reference box
precThe required precision
Returns
True if the box is enclosed by this (in or along)
Here is the call graph for this function:

◆ getAnchor2D()

Point Box::getAnchor2D ( Anchor2D anchor) const

Get the position of a specified 2D anchor

Parameters
anchorThe required anchor
Returns
The requested anchor position
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getArea()

double Box::getArea ( ) const

Get the box 2D area

Returns
The box 2D area
Here is the call graph for this function:

◆ getCentre()

Point active::geometry::Box::getCentre ( ) const
inline

Get the centre point of the box

Returns
The box centre point
Here is the caller graph for this function:

◆ getDepth()

double active::geometry::Box::getDepth ( ) const
inline

Get the box depth

Returns
The box depth
Here is the caller graph for this function:

◆ getHeight()

double active::geometry::Box::getHeight ( ) const
inline

Get the box height

Returns
The box height
Here is the caller graph for this function:

◆ getMaxLength()

double Box::getMaxLength ( ) const

Get the greatest length in any dimension

Returns
The greatest length in any dimension
Here is the call graph for this function:

◆ getVolume()

double Box::getVolume ( ) const

Get the box volume

Returns
The box volume
Here is the call graph for this function:

◆ getWidth()

double active::geometry::Box::getWidth ( ) const
inline

Get the box width

Returns
The box width
Here is the caller graph for this function:

◆ isEqual2D()

bool Box::isEqual2D ( const Box & ref,
double prec = math::eps ) const

Determine if two boxes are equal in 2D

Parameters
refThe box to compare with this
precThe required precision
Returns
True if the boxes are identical
Here is the call graph for this function:

◆ isEqual3D()

bool Box::isEqual3D ( const Box & ref,
double prec = math::eps ) const

Determine if two boxes are equal

Parameters
refThe box to compare with this
precThe required precision
Returns
True if the boxes are identical
Here is the call graph for this function:
Here is the caller graph for this function:

◆ magnify()

void Box::magnify ( double scale)

Scale the box whilst maintaining a common centre

Parameters
scaleThe ratio to scale the box by
Here is the call graph for this function:

◆ merge() [1/2]

void Box::merge ( const Box & ref)

Merge the specified box into the box bounds

Parameters
refThe box to merge
Here is the call graph for this function:

◆ merge() [2/2]

void Box::merge ( const Point & ref)

Merge the specified point into the box bounds

Parameters
refThe point to merge
Here is the call graph for this function:
Here is the caller graph for this function:

◆ moveTo()

void active::geometry::Box::moveTo ( const Point & position)
inline

Move the origin to the specified location (retaining the overall bounds)

Parameters
positionThe position to move to
Here is the call graph for this function:

◆ operator!=()

bool active::geometry::Box::operator!= ( const Box & ref) const
inline

Inequality operator

Parameters
refThe box to compare with this
Returns
True if the boxes are different
Here is the call graph for this function:

◆ operator*()

Box Box::operator* ( double scale) const

Multiplication operator

Parameters
scaleThe amount to multiply the box by
Returns
A multiplied box
Here is the call graph for this function:

◆ operator*=()

Box & Box::operator*= ( double scale)

Multiplication with assignment operator

Parameters
scaleThe amount to multiply the box by
Returns
A reference to this

◆ operator+()

Box Box::operator+ ( const Point & offset) const

Addition operator

Parameters
offsetThe amount to add to the box
Returns
An offset box
Here is the call graph for this function:

◆ operator+=()

Box & Box::operator+= ( const Point & offset)

Addition with assignment operator

Parameters
offsetThe amount to add to the box
Returns
A reference to this

◆ operator-()

Box Box::operator- ( const Point & offset) const

Subtraction operator

Parameters
offsetThe amount to subtract from the box
Returns
An offset box
Here is the call graph for this function:

◆ operator-=()

Box & Box::operator-= ( const Point & offset)

Subtraction with assignment operator

Parameters
offsetThe amount to subtract from the box
Returns
A reference to this

◆ operator/()

Box active::geometry::Box::operator/ ( double scale) const
inline

Division operator

Parameters
scaleThe amount to divide the box bounds by
Returns
A multiplied box

◆ operator/=()

Box & active::geometry::Box::operator/= ( double scale)
inline

Division with assignment operator

Parameters
scaleThe amount to divide the box bounds by
Returns
A reference to this

◆ operator=()

Box & Box::operator= ( const Box & source)

Assignment operator

Parameters
sourceThe object to copy
Returns
A reference to this
Here is the caller graph for this function:

◆ operator==()

bool active::geometry::Box::operator== ( const Box & ref) const
inline

Equality operator

Parameters
refThe box to compare with this
Returns
True if the boxes are identical
Here is the call graph for this function:

◆ overlaps2D()

bool Box::overlaps2D ( const Box & ref,
double prec = math::eps ) const

Determine if the this overlaps a another box in 2D

Parameters
refThe reference box
precThe required precision
Returns
True if the box is overlapped by this (partial or total)

◆ positionOf2D()

Position Box::positionOf2D ( const Point & ref,
double prec = math::eps ) const

Determine the relationship of a point to the box in 2D

Parameters
refThe point to test
precThe required precision
Returns
The relative position of the point
Here is the call graph for this function:
Here is the caller graph for this function:

◆ positionOf3D()

Position Box::positionOf3D ( const Point & ref,
double prec = math::eps ) const

Determine the relationship of a point to the box

Parameters
refThe point to test
precThe required precision
Returns
The relative position of the point
Here is the call graph for this function:

◆ resize()

void Box::resize ( double len)

Resize the box whilst maintaining a common centre

Parameters
lenThe amount to adjust the box bounds by
Here is the call graph for this function:

◆ rotate()

void Box::rotate ( double angle)

Rotate the box (calculate a new bounding box from the rotated box)

Parameters
angleThe rotation angle
Here is the call graph for this function:

◆ setCentre()

void active::geometry::Box::setCentre ( const Point & centre)
inline

Set the centre point of the box

Parameters
centreThe box centre point
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sort()

void Box::sort ( )

Sort the box bounds in ascending order

Here is the caller graph for this function:

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