Core 1.0
FrameScaled2 Class Reference

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

#include <frame.h>

Inheritance diagram for FrameScaled2:
Frame2

Public Member Functions

 FrameScaled2 (const Matrix2 &=Matrix2::Identity, const Vector2 &=Vector2::Null, const Vector2 &=Vector2(1.0))
 Creates a frame.
 
 FrameScaled2 (const Vector2 &, const Vector2 &)
 Creates a frame given the translation and scaling vectors.
 
 FrameScaled2 (const Vector2 &, const double &)
 Creates a frame given the translation and scale.
 
 FrameScaled2 (const Frame2 &, const Vector2 &=Vector2(1.0))
 Creates a frame.
 
 ~FrameScaled2 ()
 Empty.
 
Matrix2 R () const
 Returns the rotation matrix of the frame.
 
Vector2 T () const
 Returns the translation vector of the frame.
 
Vector2 S () const
 Get scaling vector from transformation.
 
FrameScaled2 Inverse () const
 Compute and return the inverse transformation.
 
void Rotate (const double &)
 Rotate the shape.
 
void Scale (const Vector2 &)
 Scale the shape.
 
void Scale (const double &)
 Scale the shape.
 
void Translate (const Vector2 &)
 Translate the shape.
 
Vector2 Transform (const Vector2 &) const
 Transforms a given input point.
 
Vector2 InverseTransform (const Vector2 &) const
 Inverse transformation of a given input point.
 
Vector2 TransformDirection (const Vector2 &) const
 Transforms a given input normal.
 
Vector2 InverseTransformDirection (const Vector2 &) const
 Transforms a given input normal.
 
void Compose (const FrameScaled2 &)
 Compose two frames.
 
FrameScaled2 Composed (const FrameScaled2 &) const
 Compose two frames.
 

Static Public Member Functions

static FrameScaled2 Scaling (const Vector2 &)
 Create a scaling frame.
 
static FrameScaled2 Scaling (const double &)
 Create a uniform scaling frame.
 

Static Public Attributes

static const FrameScaled2 Id
 Identity.
 

Protected Attributes

Vector2 s
 Scaling vector.
 
- Protected Attributes inherited from Frame2
Matrix2 r
 Rotation matrix.
 
Vector2 t
 Translation vector.
 

Friends

std::ostream & operator<< (std::ostream &s, const FrameScaled2 &frame)
 Overloaded.
 

Additional Inherited Members

- Protected Member Functions inherited from Frame2
 Frame2 (const Matrix2 &=Matrix2::Identity, const Vector2 &=Vector2::Null)
 Creates a frame given a rotation matrix and a translation vector.
 
 Frame2 (const double &, const Vector2 &=Vector2::Null)
 Creates a frame given a rotation angle and a translation vector.
 
 Frame2 (const Vector2 &, const Vector2 &)
 Creates a frame given the origin and its orthogonal unit vectors.
 
 ~Frame2 ()
 Empty.
 
Matrix2 R () const
 Returns the rotation matrix of the frame.
 
Vector2 T () const
 Returns the translation vector of the frame.
 
void Compose (const Frame2 &)
 Compose the frame with another one.
 
Frame2 Composed (const Frame2 &) const
 Compose the frame with another one.
 
Frame2 Inverse () const
 Compute the inverse transformation.
 
Vector2 Transform (const Vector2 &) const
 Transform a point out of the frame coordinate system.
 
Vector2 InverseTransform (const Vector2 &) const
 Transform a point into the frame coordinate system.
 
Vector2 TransformDirection (const Vector2 &) const
 Transform a direction vector out of the frame coordinate system.
 
Vector2 InverseTransformDirection (const Vector2 &) const
 Transform a direction vector into the frame coordinate system.
 
void Draw (QGraphicsScene &, const QPen &) const
 Draw a circle.
 
- Static Protected Member Functions inherited from Frame2
static Frame2 Translation (const Vector2 &)
 Creates a translation transformation.
 
static Frame2 Rotation (const double &)
 Create a rotation frame.
 
- Static Protected Attributes inherited from Frame2
static const Frame2 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 FrameScaled2 is defined by its rotation matrix, and a translation and scaling vector:

FrameScaled2(const Matrix2 &=Matrix2::Identity, const Vector2 &=Vector2::Null, const Vector2 &=Vector2(1.0))
Creates a frame.
Definition framescaled2.cpp:44
static constexpr double Pi
π.
Definition mathematics.h:178
static Matrix2 Rotation(const double &)
Create a rotation matrix.
Definition matrix2.cpp:90
Vectors in two dimensions.
Definition evector.h:628

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

FrameScaled2 frame(Matrix2::Identity,Vecto2r(-2.0,4.0),Vector2(2.0,1.0));
static const Matrix2 Identity
This static member defines the identity matrix.
Definition matrix.h:26

It is also possible and simpler to use:

FrameScaled2 frame(Vector2(-2.0,4.0),Vector2(2.0,1.0));

Some static member functions are not implemented and benefit on the conversion constructor. As an example, a translation can be coded as:

static Frame2 Translation(const Vector2 &)
Creates a translation transformation.
Definition frame2.cpp:50

Constructor & Destructor Documentation

◆ FrameScaled2() [1/4]

FrameScaled2::FrameScaled2 ( const Matrix2 & r = Matrix2::Identity,
const Vector2 & t = Vector2::Null,
const Vector2 & s = Vector2(1.0) )
explicit

Creates a frame.

Parameters
rRotation matrix.
tTranslation vector.
sScaling vector.

◆ FrameScaled2() [2/4]

FrameScaled2::FrameScaled2 ( const Vector2 & t,
const Vector2 & s )
explicit

Creates a frame given the translation and scaling vectors.

Parameters
tTranslation.
sScaling vector.

◆ FrameScaled2() [3/4]

FrameScaled2::FrameScaled2 ( const Vector2 & t,
const double & s )
explicit

Creates a frame given the translation and scale.

Parameters
tTranslation.
sUniform scaling factor.

◆ FrameScaled2() [4/4]

FrameScaled2::FrameScaled2 ( const Frame2 & frame,
const Vector2 & s = Vector2(1.0) )

Creates a frame.

Parameters
frameThe frame.
sScaling.

Member Function Documentation

◆ Compose()

void FrameScaled2::Compose ( const FrameScaled2 & frame)

Compose two frames.

Parameters
frameThe frame.

◆ Composed()

FrameScaled2 FrameScaled2::Composed ( const FrameScaled2 & frame) const

Compose two frames.

Parameters
frameThe frame.

◆ InverseTransform()

Vector2 FrameScaled2::InverseTransform ( const Vector2 & p) const

Inverse transformation of a given input point.

Parameters
pPoint.

◆ InverseTransformDirection()

Vector2 FrameScaled2::InverseTransformDirection ( const Vector2 & n) const

Transforms a given input normal.

Parameters
nNormal vector.

◆ Rotate()

void FrameScaled2::Rotate ( const double & a)

Rotate the shape.

Parameters
aRotation angle.

◆ Scale() [1/2]

void FrameScaled2::Scale ( const double & u)

Scale the shape.

Parameters
uScaling factor.

◆ Scale() [2/2]

void FrameScaled2::Scale ( const Vector2 & u)

Scale the shape.

Parameters
uScaling vector.

◆ Scaling() [1/2]

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

Create a uniform scaling frame.

Parameters
sScaling.

◆ Scaling() [2/2]

FrameScaled2 FrameScaled2::Scaling ( const Vector2 & s)
static

Create a scaling frame.

Parameters
sScaling vector.

◆ Transform()

Vector2 FrameScaled2::Transform ( const Vector2 & p) const

Transforms a given input point.

Parameters
pPoint.

◆ TransformDirection()

Vector2 FrameScaled2::TransformDirection ( const Vector2 & n) const

Transforms a given input normal.

Parameters
nNormal vector.

◆ Translate()

void FrameScaled2::Translate ( const Vector2 & t)

Translate the shape.

Parameters
tTranslation vector.

Friends And Related Symbol Documentation

◆ operator<<

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

Overloaded.

Parameters
sStream.
frameThe frame.