Core 1.0
Public Member Functions | Protected Attributes | Static Protected Attributes | Friends | List of all members
Rectangles Class Reference

Rectangles. More...

#include <rectangle.h>

Public Member Functions

 Rectangles ()
 Empty.
 
 Rectangles (const double &, const double &)
 Create a horizontal rectangle in the xy-plane, centered at the origin. More...
 
 Rectangles (const Vector &, const Vector &, const Vector &)
 Create a rectangle given its origin and two orthogonal axes. More...
 
 Rectangles (const Vector &, const Vector &, const Vector &, const double &, const double &)
 Create a rectangle given its origin and two orthogonal axes. More...
 
 ~Rectangles ()
 Empty.
 
Vector Center () const
 Gets the center of the rectangle.
 
Vector Vertex (const double &, const double &) const
 Compute the coordinates of a vertex in the rectangle. More...
 
Vector Normal () const
 Return the normal.
 
double R (const Vector &) const
 Compute the squared distance between a point and the rectangle. More...
 
Vector Normal (const Vector &) const
 Computes the vector distance between the box and a point. More...
 
void Rotate (const Matrix &)
 Rotate the rectangle. More...
 
void Translate (const Vector &)
 Translate the rectangle. More...
 
void Scale (const double &)
 Scale the rectangle. More...
 
Box GetBox () const
 Compute the box embedding the shape.
 
double Area () const
 Compute the area of the rectangle.
 
double Width () const
 Return the half width.
 
double Height () const
 Return the half height.
 

Protected Attributes

Vector z = Vector::Z
 Axes.
 
Vector c = Vector::Null
 Center.
 
double b = 1.0
 Side lengths.
 

Static Protected Attributes

static double epsilon = 1.0e-10
 Internal epsilon constant.
 

Friends

std::ostream & operator<< (std::ostream &, const Rectangles &)
 Overloaded. More...
 

Detailed Description

Rectangles.

Constructor & Destructor Documentation

◆ Rectangles() [1/3]

Rectangles::Rectangles ( const double &  a,
const double &  b 
)
explicit

Create a horizontal rectangle in the xy-plane, centered at the origin.

Parameters
a,bSize.

◆ Rectangles() [2/3]

Rectangles::Rectangles ( const Vector c,
const Vector x,
const Vector y 
)
explicit

Create a rectangle given its origin and two orthogonal axes.

Parameters
cOrigin
x,yAxes.

◆ Rectangles() [3/3]

Rectangles::Rectangles ( const Vector c,
const Vector x,
const Vector y,
const double &  a,
const double &  b 
)
explicit

Create a rectangle given its origin and two orthogonal axes.

Parameters
cOrigin
x,yUnit axes (normalized).
a,bSize.

Member Function Documentation

◆ Normal()

Vector Rectangles::Normal ( const Vector p) const

Computes the vector distance between the box and a point.

Parameters
pPoint.

◆ R()

double Rectangles::R ( const Vector p) const

Compute the squared distance between a point and the rectangle.

Parameters
pPoint.

◆ Rotate()

void Rectangles::Rotate ( const Matrix r)

Rotate the rectangle.

Parameters
rRotation matrix.

◆ Scale()

void Rectangles::Scale ( const double &  s)

Scale the rectangle.

Parameters
sScaling factor.

◆ Translate()

void Rectangles::Translate ( const Vector t)

Translate the rectangle.

Parameters
tTranslation vector.

◆ Vertex()

Vector Rectangles::Vertex ( const double &  u,
const double &  v 
) const

Compute the coordinates of a vertex in the rectangle.

Parameters
u,vCoordinates of the point.

Friends And Related Function Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  s,
const Rectangles rectangle 
)
friend

Overloaded.

Parameters
sStream.
rectangleThe rectangle.