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

A core axis class. More...

#include <axis.h>

Inheritance diagram for Axis:
Cone ConeSphere Cylinder NewCone Taper Tubular Twist Capsule RevolutionQuadricTube

Public Member Functions

 Axis ()
 Empty.
 
 Axis (const Vector &, const Vector &)
 Creates an axis given end vertices. More...
 
 ~Axis ()
 Empty.
 
void Rotate (const Matrix &)
 Rotates an axis. More...
 
void Translate (const Vector &)
 Translates an axis. More...
 
void Scale (const double &)
 Uniformly scales an axis. More...
 
void Scale (const Vector &)
 Scales an axis. More...
 
Quadric Equation (const Ray &) const
 Compute the polynomial equation of the Euclidean distance between a ray and the axis. More...
 
Vector Vertex (int) const
 Return one of the end vertexes of the axis.
 
Vector Point (const double &) const
 Compute a point on the axis.
 
Vector GetAxis () const
 Returns the normalized axis vector.
 
double Length () const
 Return the axis length.
 
Vector Symmetric (const Vector &) const
 Symmetric point. More...
 
Sphere Symmetric (const Sphere &) const
 Symmetric sphere. More...
 
Vector Normal (const Vector &) const
 Compute the normal vector between a point and its projection onto the edge. More...
 
double R (const Vector &) const
 Compute the squared distance to the segment. More...
 
double R (const Axis &) const
 Compute the squared distance between two axes. More...
 
double R (const Vector &, double &) const
 Compute the squared distance to the axis. More...
 
Matrix GetFrame () const
 Compute an orthonormal frame attached to the axis. More...
 

Static Public Member Functions

static Matrix GetFrame (const Vector &)
 Compute an orthonormal frame attached to the axis. More...
 
static Vector BoxVector (const Vector &)
 Compute the box vector extent of a unit circle with a given axis. More...
 

Protected Member Functions

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

Protected Attributes

Vector b = Vector::Z
 End vertices of the axis.
 
Vector axis = Vector::Z
 Normalized axis vector.
 
double length = 1.0
 Length of the axis.
 

Friends

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

Detailed Description

A core axis class.

The class includes the two end vertices Axis::a and Axis::b, the normalized direction Axis::axis and the length Axis::length. It is used in several geometric classes such as Cylinder, Capsule, Cone and deformations such as Taper or Twist.

Constructor & Destructor Documentation

◆ Axis()

Axis::Axis ( const Vector a,
const Vector b 
)
explicit

Creates an axis given end vertices.

Parameters
a,bEnd vertices of the axis.

Member Function Documentation

◆ BoxVector()

Vector Axis::BoxVector ( const Vector axis)
inlinestatic

Compute the box vector extent of a unit circle with a given axis.

Parameters
axisAxis (should be unit).

This function is used in particular in Cylinder::GetBox(), Cone::GetBox(), Capsule::GetBox().

◆ Equation()

Quadric Axis::Equation ( const Ray ray) const

Compute the polynomial equation of the Euclidean distance between a ray and the axis.

Parameters
rayThe ray.

◆ GetFrame() [1/2]

Matrix Axis::GetFrame ( ) const

Compute an orthonormal frame attached to the axis.

See also
Axis::GetFrame(const Vector&)

◆ GetFrame() [2/2]

Matrix Axis::GetFrame ( const Vector z)
static

Compute an orthonormal frame attached to the axis.

The axes of the frame are defined as the column vectors of the returned matrix.

Matrix m = Axis::GetFrame(Vector(1.0,2.0,-1.0));
for (int i=0;i<16;i++)
{
Vector p=m*Vector(cos(i/16.0),sin(i/16.0),0.0);
}
Matrix GetFrame() const
Compute an orthonormal frame attached to the axis.
Definition: axis.cpp:202
This class implements 32 matrix.
Definition: matrix.h:14
Vectors in three dimensions.
Definition: evector.h:21
Parameters
zVector, which should be unit.
See also
Axis::GetFrame()

◆ Normal()

Vector Axis::Normal ( const Vector p) const

Compute the normal vector between a point and its projection onto the edge.

Parameters
pPoint.

◆ R() [1/3]

double Axis::R ( const Axis axis) const

Compute the squared distance between two axes.

Parameters
axisThe other axis.

◆ R() [2/3]

double Axis::R ( const Vector p) const

Compute the squared distance to the segment.

This function is more efficient than Segment::R(const Vector&) const as Axis stores the unit vector.

Parameters
pPoint.

◆ R() [3/3]

double Axis::R ( const Vector p,
double &  s 
) const

Compute the squared distance to the axis.

Parameters
pPoint.
sSigned distance of the projection of argument point p onto the edge.

◆ Radial() [1/2]

Vector2 Axis::Radial ( const Vector 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 Axis::Radial ( const Vector p,
Vector av,
Vector rv 
) const
inlineprotected

Compute the radial coordinates of a point.

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

◆ Rotate()

void Axis::Rotate ( const Matrix r)

Rotates an axis.

Only the vertices and the axis vector are modified, whereas the length is perserved.

Parameters
rRotation matrix.

◆ Scale() [1/2]

void Axis::Scale ( const double &  s)

Uniformly scales an axis.

Parameters
sScaling factor.

◆ Scale() [2/2]

void Axis::Scale ( const Vector s)

Scales an axis.

Parameters
sScaling vector.

◆ Symmetric() [1/2]

Sphere Axis::Symmetric ( const Sphere sphere) const

Symmetric sphere.

Parameters
sphereThe sphere.

◆ Symmetric() [2/2]

Vector Axis::Symmetric ( const Vector p) const

Symmetric point.

Parameters
pThe point.

◆ Translate()

void Axis::Translate ( const Vector t)

Translates an axis.

Parameters
tTranslation vector.

Friends And Related Function Documentation

◆ operator<<

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

Overloaded.

Parameters
sStream.
axisThe axis.