Core 1.0
Axis2 Class Reference

A core axis class. More...

#include <axis.h>

Inheritance diagram for Axis2:
Capsule2 RevolutionQuadricVolume2

Public Member Functions

 Axis2 ()
 Empty.
 
 Axis2 (const Vector2 &, const Vector2 &)
 Creates an axis given end vertices.
 
 ~Axis2 ()
 Empty.
 
Vector2 Vertex (int) const
 Return one of the end vertexes of the axis.
 
Vector2 Point (const double &) const
 Compute a point on the axis.
 
Vector2 GetAxis () const
 Returns the normalized axis vector.
 
constexpr double Length () const
 Return the axis length.
 
void Translate (const Vector2 &)
 Translation.
 
void Rotate (const Matrix2 &)
 Rotation.
 
void Scale (const double &)
 Scaling.
 
Vector2 Symmetric (const Vector2 &) const
 Symmetric point.
 
Circle2 Symmetric (const Circle2 &) const
 Symmetric circle.
 
Box2 Symmetric (const Box2 &) const
 Symmetric box.
 

Protected Member Functions

double Radial (const Vector2 &, Vector2 &, Vector2 &) const
 Compute the radial coordinates of a point.
 
Vector2 Radial (const Vector2 &) const
 Compute the radial coordinates of a point.
 

Protected Attributes

Vector2 b = Vector2(1.0, 0.0)
 End vertexes of the axis.
 
Vector2 axis = Vector2::X
 Normalized axis vector.
 
double length = 1.0
 Length of the axis.
 

Friends

std::ostream & operator<< (std::ostream &s, const Axis2 &axis)
 Overloaded.
 

Detailed Description

A core axis class.

Constructor & Destructor Documentation

◆ Axis2()

Axis2::Axis2 ( const Vector2 & a,
const Vector2 & b )
explicit

Creates an axis given end vertices.

Parameters
a,bEnd vertices of the axis.

Member Function Documentation

◆ Radial() [1/2]

Vector2 Axis2::Radial ( const Vector2 & p) const
inlineprotected

Compute the radial coordinates of a point.

Parameters
pPoint.
Returns
A vector (x,y) where x is the radial coordinate and y the axial coordinate.

◆ Radial() [2/2]

double Axis2::Radial ( const Vector2 & p,
Vector2 & av,
Vector2 & rv ) const
inlineprotected

Compute the radial coordinates of a point.

Parameters
pPoint.
avReturned axis vector.
rvReturned radial vector.
Returns
Axial coordinate.

◆ Rotate()

void Axis2::Rotate ( const Matrix2 & r)

Rotation.

Parameters
rRotation matrix.

◆ Scale()

void Axis2::Scale ( const double & s)

Scaling.

Parameters
sScaling factor.

◆ Symmetric() [1/3]

Box2 Axis2::Symmetric ( const Box2 & box) const

Symmetric box.

Parameters
boxThe box.

◆ Symmetric() [2/3]

Circle2 Axis2::Symmetric ( const Circle2 & circle) const

Symmetric circle.

Parameters
circleThe circle.

◆ Symmetric() [3/3]

Vector2 Axis2::Symmetric ( const Vector2 & p) const

Symmetric point.

Parameters
pThe point.

◆ Translate()

void Axis2::Translate ( const Vector2 & t)

Translation.

Parameters
tTranslation vector.

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream & s,
const Axis2 & axis )
friend

Overloaded.

Parameters
sStream.
axisThe axis.