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

Quadrangles. More...

#include <quadrangle.h>

Public Member Functions

 Quadrangle ()
 Empty.
 
 Quadrangle (const Vector &, const Vector &, const Vector &, const Vector &)
 Create a quadrangle. More...
 
 Quadrangle (double, double)
 Create a horizontal quadrangle. More...
 
 ~Quadrangle ()
 Empty.
 
Vector Vertex (const double &, const double &) const
 Compute the position of a vertex inside the quadrangle. More...
 
Vector Normal (const double &, const double &) const
 Compute the normal of a vertex inside the quadrangle. More...
 
Vector Normal () const
 Compute the normal of the quadrangle. More...
 
void Rotate (const Matrix &)
 Rotate the quadrangle. More...
 
void Translate (const Vector &)
 Translate the quadrangle. More...
 
void Scale (const double &)
 Scale the quadrangle. More...
 
void Transform (const FrameScaled &)
 Transform the quadrangle. More...
 

Protected Attributes

Vector p [4] = { Vector::Null,Vector::X,Vector::X + Vector::Y,Vector::Y }
 Vertices, stored in counter-clockwize order.
 

Static Protected Attributes

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

Detailed Description

Quadrangles.

Quadrangles should be planar and convex.

Constructor & Destructor Documentation

◆ Quadrangle() [1/2]

Quadrangle::Quadrangle ( const Vector a,
const Vector b,
const Vector c,
const Vector d 
)
explicit

Create a quadrangle.

Parameters
a,b,c,dVertices.

◆ Quadrangle() [2/2]

Quadrangle::Quadrangle ( double  x,
double  y 
)
explicit

Create a horizontal quadrangle.

Parameters
x,yHalf size, the quadrangle vertexes will have (±x ±y) coordinates.

Member Function Documentation

◆ Normal() [1/2]

Vector Quadrangle::Normal ( ) const

Compute the normal of the quadrangle.

The quadrangle should be flat.

◆ Normal() [2/2]

Vector Quadrangle::Normal ( const double &  u,
const double &  v 
) const

Compute the normal of a vertex inside the quadrangle.

Parameters
u,vParametric coordinates of the vertex.

◆ Rotate()

void Quadrangle::Rotate ( const Matrix r)

Rotate the quadrangle.

Parameters
rRotation matrix.

◆ Scale()

void Quadrangle::Scale ( const double &  s)

Scale the quadrangle.

Parameters
sScaling factor.

◆ Transform()

void Quadrangle::Transform ( const FrameScaled frame)

Transform the quadrangle.

Parameters
frameTransformation.

◆ Translate()

void Quadrangle::Translate ( const Vector t)

Translate the quadrangle.

Parameters
tTranslation vector.

◆ Vertex()

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

Compute the position of a vertex inside the quadrangle.

Parameters
u,vParametric coordinates of the vertex.