Hide menu
Loading...
Searching...
No Matches
cadex::Geom::Box2d Class Reference

Defines a 2D oriented box. More...

#include <cadex/AlgoGeom/Box2d.hxx>

Public Member Functions

 Box2d (const Geom::Axis2d &theAxis, double theXRange, double theYRange)
 Constructor.
 
bool IsInfinite () const
 Returns true if at least one coordinate is infinite.
 
void SetAxis (const Geom::Axis2d &theAxis)
 Sets the axis of Box2d.
 
void SetXRange (double theXRange)
 Sets the range of Box2d along the X-axis to the specified value. The value must be greater than zero.
 
void SetYRange (double theYRange)
 Sets the range of Box2d along the Y-axis to the specified value. The value must be greater than zero.
 
const Geom::Axis2d & Axis () const
 
double XRange () const
 
double YRange () const
 
const Geom::Point2d & Center () const
 
Geom::Point2d Corner (size_t theIndex) const
 Returns the box corner. theIndex must be from 0 to 3.
 
std::array< Geom::Point2d, 4 > Corners () const
 Returns the four corner points of the box.
 
double Area () const
 Returns the area of the box.
 
double Perimeter () const
 Returns the perimeter of the box.
 
bool Contains (const Geom::Point2d &thePoint) const
 Returns true if the point lies inside the Box2d.
 
void Multiply (double theValue)
 Scales Box2d by scalar value.
 
Box2d Multiplied (double theValue) const
 Returns the Box2d scaled by scalar value.
 
void Transform (const Geom::Transformation2d &theTransformation)
 Transforms the Box2d.
 
Box2d Transformed (const Geom::Transformation2d &theTransformation) const
 Returns the transformed Box2d.
 

Detailed Description

Defines a 2D oriented box.

The Box2d is defined via 2d axis, x-range and y-range.

Constructor & Destructor Documentation

◆ Box2d()

cadex::Geom::Box2d::Box2d ( const Geom::Axis2d & theAxis,
double theXRange,
double theYRange )

Constructor.

Creates a Box2d from axis, x-range and y-range. The dimensions must be greater than zero.

Member Function Documentation

◆ Area()

double cadex::Geom::Box2d::Area ( ) const

Returns the area of the box.

◆ Contains()

bool cadex::Geom::Box2d::Contains ( const Geom::Point2d & thePoint) const

Returns true if the point lies inside the Box2d.

◆ Corner()

Geom::Point2d cadex::Geom::Box2d::Corner ( size_t theIndex) const

Returns the box corner. theIndex must be from 0 to 3.

◆ Corners()

std::array< Geom::Point2d, 4 > cadex::Geom::Box2d::Corners ( ) const

Returns the four corner points of the box.

◆ IsInfinite()

bool cadex::Geom::Box2d::IsInfinite ( ) const

Returns true if at least one coordinate is infinite.

"Infinite" means that coordinate's absolute value is greater than \(10^{100}\).

◆ Multiplied()

Box2d cadex::Geom::Box2d::Multiplied ( double theValue) const

Returns the Box2d scaled by scalar value.

◆ Multiply()

void cadex::Geom::Box2d::Multiply ( double theValue)

Scales Box2d by scalar value.

Multiplies ranges of the box by theValue.

◆ Perimeter()

double cadex::Geom::Box2d::Perimeter ( ) const

Returns the perimeter of the box.

◆ SetAxis()

void cadex::Geom::Box2d::SetAxis ( const Geom::Axis2d & theAxis)

Sets the axis of Box2d.

◆ SetXRange()

void cadex::Geom::Box2d::SetXRange ( double theXRange)

Sets the range of Box2d along the X-axis to the specified value. The value must be greater than zero.

◆ SetYRange()

void cadex::Geom::Box2d::SetYRange ( double theYRange)

Sets the range of Box2d along the Y-axis to the specified value. The value must be greater than zero.

◆ Transform()

void cadex::Geom::Box2d::Transform ( const Geom::Transformation2d & theTransformation)

Transforms the Box2d.

Transforms the axis of the box and scales its dimensions according to the transform scaling factor.

◆ Transformed()

Box2d cadex::Geom::Box2d::Transformed ( const Geom::Transformation2d & theTransformation) const

Returns the transformed Box2d.