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

A transformation defined as the composition of a rotation, a translation and a scale. More...

#include <frame.h>

Inheritance diagram for FrameScaled:
Frame

Public Member Functions

 FrameScaled (const Matrix &=Matrix::Identity, const Vector &=Vector::Null, const Vector &=Vector(1.0))
 Creates a frame. More...
 
 FrameScaled (const Vector &)
 Creates a translation frame. More...
 
 FrameScaled (const Vector &, const Vector &)
 Creates a frame given the translation and scaling vectors. More...
 
 FrameScaled (const Vector &, const double &)
 Creates a frame given the translation and scale. More...
 
 FrameScaled (const Vector &, const Vector &, const Vector &, const Vector &)
 Creates a frame given the origin of the frame and orthogonal unit vectors. More...
 
 FrameScaled (const Frame &, const Vector &=Vector(1.0))
 Creates a frame. More...
 
 ~FrameScaled ()
 Empty.
 
Matrix R () const
 Returns the rotation matrix of the frame.
 
Vector T () const
 Returns the translation vector of the frame.
 
Vector S () const
 Get scaling vector from transformation.
 
void Rotate (const Vector &)
 Rotate the shape. More...
 
void ObjectRotate (const Vector &)
 Rotate the shape in object coordinates (does not modify the translation vector). More...
 
void Scale (const Vector &)
 Scale the shape. More...
 
void Scale (const double &)
 Scale the shape. More...
 
void Translate (const Vector &)
 Translate the shape. More...
 
Matrix4 GetMatrix () const
 Get the homogeneous matrix out of the frame.
 
Vector Transform (const Vector &) const
 Transforms a given input point. More...
 
Vector InverseTransform (const Vector &) const
 Inverse transformation of a given input point. More...
 
Vector TransformDirection (const Vector &) const
 Transforms a given input normal. More...
 
Vector InverseTransformDirection (const Vector &) const
 Transforms a given input normal. More...
 
void Compose (const FrameScaled &)
 Compose two frames. More...
 
FrameScaled Composed (const FrameScaled &) const
 Compose two frames. More...
 
void Lerp (const FrameScaled &, const FrameScaled &, const double &)
 Linear interpolation of two frames. More...
 

Static Public Member Functions

static FrameScaled Translation (const Vector &)
 Creates a translation transformation. More...
 
static FrameScaled Rotation (const Vector &)
 Creates a rotation frame. More...
 
static FrameScaled Rotation (const Vector &, const double &)
 Create a rotation frame about an arbitrary axis. More...
 
static FrameScaled Rotation (const Vector &, const Vector &)
 Create a frame that rotates a normalized vector into another one. More...
 
static FrameScaled Scaling (const Vector &)
 Create a scaling frame. More...
 
static FrameScaled Scaling (const double &)
 Create a uniform scaling frame. More...
 

Static Public Attributes

static const FrameScaled Id
 Identity.
 

Protected Attributes

Vector s
 Scaling vector.
 
- Protected Attributes inherited from Frame
Matrix r
 Rotation matrix.
 
Vector t
 Translation vector.
 

Friends

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

Additional Inherited Members

- Protected Member Functions inherited from Frame
 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 Protected Member Functions inherited from Frame
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 Protected Attributes inherited from Frame
static const Frame Id
 Identity.
 

Detailed Description

A transformation defined as the composition of a rotation, a translation and a scale.

The data-structure groups the rotation matrix, the translation and scaling vectors.

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

In general, a FrameScaled is defined by its rotation matrix, and a translation and scaling vector:

FrameScaled frame(Matrix::Rotation(Vector( Math::Pi/4.0,0.0, 0.0)),Vector(0.0),Vector(1.0,1.0,2.0));
A transformation defined as the composition of a rotation, a translation and a scale.
Definition: frame.h:131
static const double Pi
π.
Definition: mathematics.h:174
static Matrix Rotation(const Vector &)
Create a rotation matrix given a vector of angles that specifies the rotation around each world coord...
Definition: matrix.cpp:117
Vectors in three dimensions.
Definition: evector.h:21

When there is no rotation, the rotation matrix can be defined using the identity matrix:

FrameScaled frame(Matrix::Identity,Vector(-2.0,4.0,0.0),Vector(2.0,1.0,1.0));
static const Matrix Identity
Identity matrix.
Definition: matrix.h:26

It is also possible and simpler to use:

FrameScaled frame(Vector(-2.0,4.0,0.0),Vector(2.0,1.0,1.0));

Constructor & Destructor Documentation

◆ FrameScaled() [1/6]

FrameScaled::FrameScaled ( const Matrix r = Matrix::Identity,
const Vector t = Vector::Null,
const Vector s = Vector(1.0) 
)
explicit

Creates a frame.

Parameters
rRotation matrix.
tTranslation vector.
sScaling vector.

◆ FrameScaled() [2/6]

FrameScaled::FrameScaled ( const Vector t)
explicit

Creates a translation frame.

Parameters
tTranslation.

◆ FrameScaled() [3/6]

FrameScaled::FrameScaled ( const Vector t,
const Vector s 
)
explicit

Creates a frame given the translation and scaling vectors.

Parameters
tTranslation.
sScaling vector.

◆ FrameScaled() [4/6]

FrameScaled::FrameScaled ( const Vector t,
const double &  s 
)
explicit

Creates a frame given the translation and scale.

Parameters
tTranslation.
sUniform scaling factor.

◆ FrameScaled() [5/6]

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

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

Parameters
cOrigin.
x,y,zOrthogonal unit vectors.

◆ FrameScaled() [6/6]

FrameScaled::FrameScaled ( const Frame frame,
const Vector s = Vector(1.0) 
)

Creates a frame.

Parameters
frameThe frame.
sScaling.

Member Function Documentation

◆ Compose()

void FrameScaled::Compose ( const FrameScaled frame)

Compose two frames.

Parameters
frameThe frame.

◆ Composed()

FrameScaled FrameScaled::Composed ( const FrameScaled frame) const

Compose two frames.

Parameters
frameThe frame.

◆ InverseTransform()

Vector FrameScaled::InverseTransform ( const Vector p) const

Inverse transformation of a given input point.

Parameters
pPoint.

◆ InverseTransformDirection()

Vector FrameScaled::InverseTransformDirection ( const Vector n) const

Transforms a given input normal.

Parameters
nNormal vector.

◆ Lerp()

void FrameScaled::Lerp ( const FrameScaled a,
const FrameScaled b,
const double &  alpha 
)

Linear interpolation of two frames.

Parameters
a,bThe two frames.
alphaInterpolation parameter.
Returns
Interpolated frame.

◆ ObjectRotate()

void FrameScaled::ObjectRotate ( const Vector r)

Rotate the shape in object coordinates (does not modify the translation vector).

Parameters
rRotation vector representing the rotation angles around x, y and z axes.

◆ Rotate()

void FrameScaled::Rotate ( const Vector r)

Rotate the shape.

Parameters
rRotation vector representing the rotation angles around x, y and z axes.

◆ Rotation() [1/3]

FrameScaled FrameScaled::Rotation ( const Vector a)
static

Creates a rotation frame.

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

◆ Rotation() [2/3]

FrameScaled FrameScaled::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]

FrameScaled FrameScaled::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 (should be normalized).

◆ Scale() [1/2]

void FrameScaled::Scale ( const double &  u)

Scale the shape.

Parameters
uScaling factor.

◆ Scale() [2/2]

void FrameScaled::Scale ( const Vector u)

Scale the shape.

Parameters
uScaling vector.

◆ Scaling() [1/2]

FrameScaled FrameScaled::Scaling ( const double &  s)
static

Create a uniform scaling frame.

Parameters
sScaling.

◆ Scaling() [2/2]

FrameScaled FrameScaled::Scaling ( const Vector s)
static

Create a scaling frame.

Parameters
sScaling vector.

◆ Transform()

Vector FrameScaled::Transform ( const Vector p) const

Transforms a given input point.

Parameters
pPoint.

◆ TransformDirection()

Vector FrameScaled::TransformDirection ( const Vector n) const

Transforms a given input normal.

Parameters
nNormal vector.

◆ Translate()

void FrameScaled::Translate ( const Vector t)

Translate the shape.

Parameters
tTranslation vector.

◆ Translation()

FrameScaled FrameScaled::Translation ( const Vector t)
static

Creates a translation transformation.

Parameters
tTranslation vector.

Friends And Related Function Documentation

◆ operator<<

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

Overloaded.

Parameters
sStream.
frameThe frame.