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

Solid transformations. More...

#include <frame.h>

Inheritance diagram for Frame:
FrameScaled OrientedBox

Public Member Functions

 Frame (const Matrix &=Matrix::Identity, const Vector &=Vector::Null)
 Creates a frame given a rotation matrix and a translation vector. More...
 
 Frame (const Vector &, const Vector &, const Vector &, const Vector &)
 Creates a frame given the origin and its orthogonal unit vectors. More...
 
 ~Frame ()
 Empty.
 
Matrix R () const
 Returns the rotation matrix of the frame.
 
Vector T () const
 Returns the translation vector of the frame.
 
Vector GetVector (int) const
 Returns the i-th basis vector of the frame. More...
 
void Compose (const Frame &)
 Compose the frame with another one. More...
 
Frame Composed (const Frame &) const
 Compose the frame with another one. More...
 
Frame Inverse () const
 Compute the inverse transformation.
 
Vector Transform (const Vector &) const
 Transform a point out of the frame coordinate system. More...
 
Vector InverseTransform (const Vector &) const
 Transform a point into the frame coordinate system. More...
 
Vector TransformDirection (const Vector &) const
 Transform a direction vector out of the frame coordinate system. More...
 
Vector InverseTransformDirection (const Vector &) const
 Transform a direction vector into the frame coordinate system.
 
Ray Transform (const Ray &) const
 Transform a ray out of the frame coordinate system. More...
 
Ray InverseTransform (const Ray &) const
 Transform a ray into the frame coordinate system. More...
 
Vector CircleVertex (const double &, int=1, int=2) const
 Compute the coordinates of a point on a circle inside the frame;. More...
 
Vector CircleNormal (const double &, int=1, int=2) const
 Compute the coordinates of the normal a point on a circle inside the frame;. More...
 
Vector SphereVertex (const double &, const double &, const double &, int=1, int=2, int=0) const
 Compute the coordinates of a point on a sphere inside the frame. More...
 
Vector SphereNormal (const double &, const double &, int=1, int=2, int=0) const
 Compute the coordinates of the normal of a point on a sphere inside the frame. More...
 

Static Public Member Functions

static Frame Translation (const Vector &)
 Creates a translation transformation. More...
 
static Frame Rotation (const Vector &)
 Creates a rotation frame. More...
 
static Frame Rotation (const Vector &, const double &)
 Create a rotation frame about an arbitrary axis. More...
 
static Frame Rotation (const Vector &, const Vector &)
 Create a frame that rotates a normalized vector into another one. More...
 
static Frame Canonical (const Vector &, const Vector &)
 Given a point and a direction, compute the frame that brings these into a canonical coordinate system. More...
 
static Frame Orthonormal (const Vector &, const Vector &)
 Compute a frame given an origin and direction vector. More...
 

Static Public Attributes

static const Frame Id
 Identity.
 

Protected Attributes

Matrix r
 Rotation matrix.
 
Vector t
 Translation vector.
 

Friends

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

Detailed Description

Solid transformations.

The class groups the rotation matrix and the translation vector.

The orientation of the frame should be defined by the appropriate rotation matrix.

The inverse transformation is implicitly characterized as the transposed matrix and the opposite translation vector.

Constructor & Destructor Documentation

◆ Frame() [1/2]

Frame::Frame ( const Matrix r = Matrix::Identity,
const Vector t = Vector::Null 
)
explicit

Creates a frame given a rotation matrix and a translation vector.

Parameters
rFrame matrix.
tTranslation vector.

◆ Frame() [2/2]

Frame::Frame ( const Vector c,
const Vector x,
const Vector y,
const Vector z 
)
explicit

Creates a frame given the origin and its orthogonal unit vectors.

Parameters
cOrigin.
x,y,zOrthonormal vectors.

Member Function Documentation

◆ Canonical()

Frame Frame::Canonical ( const Vector p,
const Vector axis 
)
static

Given a point and a direction, compute the frame that brings these into a canonical coordinate system.

This is useful for computing the canonical coordinate system of revolution objects such as cylinders or cones.

Parameters
pOrigin of the frame.
axisVertical z-axis of the frame.

◆ CircleNormal()

Vector Frame::CircleNormal ( const double &  theta,
int  i = 1,
int  j = 2 
) const

Compute the coordinates of the normal a point on a circle inside the frame;.

Parameters
thetaEuler angle.
i,jIntegers representing which column vector of the matrix will be used as basis.

◆ CircleVertex()

Vector Frame::CircleVertex ( const double &  theta,
int  i = 1,
int  j = 2 
) const

Compute the coordinates of a point on a circle inside the frame;.

Parameters
thetaEuler angle.
i,jIntegers representing which column vector of the matrix will be used as basis.

◆ Compose()

void Frame::Compose ( const Frame frame)

Compose the frame with another one.

Parameters
frameThe frame.

◆ Composed()

Frame Frame::Composed ( const Frame frame) const

Compose the frame with another one.

Parameters
frameThe frame.

◆ GetVector()

Vector Frame::GetVector ( int  i) const
inline

Returns the i-th basis vector of the frame.

This is a convenience function, which is the same as:

Frame frame;
Vector y=frame.R().C(1); // Get rotation matrix, and then column vector.
Solid transformations.
Definition: frame.h:11
Matrix R() const
Returns the rotation matrix of the frame.
Definition: frame.h:68
Vector C(int) const
Get the i-th column vector of the matrix.
Definition: matrix.h:202
Vectors in three dimensions.
Definition: evector.h:21
Parameters
iColumn index.

◆ InverseTransform() [1/2]

Ray Frame::InverseTransform ( const Ray ray) const

Transform a ray into the frame coordinate system.

Parameters
rayThe ray.

◆ InverseTransform() [2/2]

Vector Frame::InverseTransform ( const Vector p) const
inline

Transform a point into the frame coordinate system.

Parameters
pPoint.

◆ Orthonormal()

Frame Frame::Orthonormal ( const Vector c,
const Vector n 
)
static

Compute a frame given an origin and direction vector.

See also
Vector::Orthonormal(Vector&,Vector&)
Parameters
cOrigin.
nDirection.

◆ Rotation() [1/3]

Frame Frame::Rotation ( const Vector a)
static

Creates a rotation frame.

Parameters
aA vector of angles (should be in radians) that defines the rotation x-y-z axes.

◆ Rotation() [2/3]

Frame Frame::Rotation ( const Vector axis,
const double &  angle 
)
static

Create a rotation frame about an arbitrary axis.

Parameters
axisAxis.
angleAngle (should be in radian).

◆ Rotation() [3/3]

Frame Frame::Rotation ( const Vector a,
const Vector b 
)
static

Create a frame that rotates a normalized vector into another one.

Parameters
a,bInitial and final vectors (which should be normalized).

◆ SphereNormal()

Vector Frame::SphereNormal ( const double &  theta,
const double &  phi,
int  i = 1,
int  j = 2,
int  k = 0 
) const

Compute the coordinates of the normal of a point on a sphere inside the frame.

Parameters
theta,phiPolar coordinates.
i,j,kIntegers representing which column vector of the matrix will be used as basis.

◆ SphereVertex()

Vector Frame::SphereVertex ( const double &  r,
const double &  theta,
const double &  phi,
int  i = 1,
int  j = 2,
int  k = 0 
) const

Compute the coordinates of a point on a sphere inside the frame.

Parameters
rRadius.
theta,phiPolar coordinates.
i,j,kIntegers representing which column vector of the matrix will be used as basis.

◆ Transform() [1/2]

Ray Frame::Transform ( const Ray ray) const

Transform a ray out of the frame coordinate system.

Parameters
rayThe ray.

◆ Transform() [2/2]

Vector Frame::Transform ( const Vector p) const
inline

Transform a point out of the frame coordinate system.

Parameters
pPoint.

◆ TransformDirection()

Vector Frame::TransformDirection ( const Vector n) const
inline

Transform a direction vector out of the frame coordinate system.

Parameters
nVector.

◆ Translation()

Frame Frame::Translation ( const Vector t)
static

Creates a translation transformation.

Matrix is identity whereas the translation vector is computed from the argument vector.

Parameters
tTranslation vector.

Friends And Related Function Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  s,
const Frame frame 
)
friend

Overloaded.

Parameters
sStream.
frameThe frame.