version 0.6.0
Loading...
Searching...
No Matches
mod_cg_transformation::t_cg_transformation Type Reference

Representation of a transformation.

Public Member Functions

procedure initialize (transformation, dimension)
 Initialize the transformation to the identity.
 
procedure compose (transformation, target)
 Compose two transformations.
 
procedure add_rotation_x (transformation, angle)
 Add a rotation around the x axis.
 
procedure add_rotation_y (transformation, angle)
 Add a rotation around the y axis.
 
procedure add_rotation_z (transformation, angle)
 Add a rotation around the z axis.
 
procedure add_rotation (transformation, axis, angle)
 Add a rotation around a given axis.
 
procedure add_rotation_cos_sin (transformation, axis, c, s)
 Add a rotation around a given axis.
 
procedure add_translation (transformation, vector)
 Add a translation.
 
procedure add_scale_x (transformation, factor)
 Add a scaling factor in direction x.
 
procedure add_scale_y (transformation, factor)
 Add a scaling factor in direction y.
 
procedure add_scale_z (transformation, factor)
 Add a scaling factor in direction z.
 
procedure add_scale (transformation, vector)
 Add a scaling in every direction.
 
procedure transform_point (transformation, point)
 Apply a transformation to a point.
 
procedure transform_direction (transformation, direction)
 Apply a transformation to a direction.
 
procedure inverse_transform_point (transformation, point)
 Apply an inverse transformation to a point.
 
procedure inverse_transform_direction (transformation, direction)
 Apply an inverse transformation to a direction.
 

Public Attributes

double precision, dimension(4, 4) matrix = reshape([1d0, 0d0, 0d0, 0d0, 0d0, 1d0, 0d0, 0d0, 0d0, 0d0, 1d0, 0d0, 0d0, 0d0, 0d0, 1d0], [4,4])
 Transformation matrix.
 
double precision, dimension(4, 4) inverse_matrix = reshape([1d0, 0d0, 0d0, 0d0, 0d0, 1d0, 0d0, 0d0, 0d0, 0d0, 1d0, 0d0, 0d0, 0d0, 0d0, 1d0], [4,4])
 Inverse of the transformation matrix.
 
integer dimension = 0
 Dimension of the transformation matrix.
 

Member Function/Subroutine Documentation

◆ add_rotation()

procedure mod_cg_transformation::t_cg_transformation::add_rotation ( class(t_cg_transformation), intent(inout) transformation,
double precision, dimension(3), intent(in) axis,
double precision, intent(in) angle )

Compose by a rotation matrix. Refer to the code to see the coefficients. Note that the axis can be a non-unit vector. It is normalized in the routine. A null axis results in a null rotation, that is the identity matrix.

Parameters
[in,out]transformationtransformation that receive the transformation
[in]axisrotation axis which will be normalized
[in]angleangle of rotation in radians

◆ add_rotation_cos_sin()

procedure mod_cg_transformation::t_cg_transformation::add_rotation_cos_sin ( class(t_cg_transformation), intent(inout) transformation,
double precision, dimension(3), intent(in) axis,
double precision, intent(in) c,
double precision, intent(in) s )

Compose by a rotation matrix. Refer to the code to see the coefficients. Note that the axis can be a non-unit vector. It is normalized in the routine. A null axis results in a null rotation, that is the identity matrix.

Parameters
[in,out]transformationtransformation that receive the transformation
[in]axisrotation axis which will be normalized
[in]c,scosine and sine of the angle of rotation

◆ add_rotation_x()

procedure mod_cg_transformation::t_cg_transformation::add_rotation_x ( class(t_cg_transformation), intent(inout) transformation,
double precision, intent(in) angle )

Compose by the following rotation matrix:

   !! ┌─────┬─────┬─────┬─────┐
   !! │  1  │  0  │  0  │  0  │
   !! ├─────┼─────┼─────┼─────┤
   !! │  0  │  c  │ -s  │  0  │
   !! ├─────┼─────┼─────┼─────┤
   !! │  0  │  s  │  c  │  0  │
   !! ├─────┼─────┼─────┼─────┤
   !! │  0  │  0  │  0  │  1  │
   !! └─────┴─────┴─────┴─────┘
   !! 

Where s and c are the sine and the cosine of the angle.

Warning
Do not apply this transformation in 2D
Parameters
[in,out]transformationtransformation that receive the transformation
[in]angleangle of rotation in radians

◆ add_rotation_y()

procedure mod_cg_transformation::t_cg_transformation::add_rotation_y ( class(t_cg_transformation), intent(inout) transformation,
double precision, intent(in) angle )

Compose by the following rotation matrix:

   !! ┌─────┬─────┬─────┬─────┐
   !! │  c  │  0  │  s  │  0  │
   !! ├─────┼─────┼─────┼─────┤
   !! │  0  │  1  │  0  │  0  │
   !! ├─────┼─────┼─────┼─────┤
   !! │ -s  │  0  │  c  │  0  │
   !! ├─────┼─────┼─────┼─────┤
   !! │  0  │  0  │  0  │  1  │
   !! └─────┴─────┴─────┴─────┘
   !! 

Where s and c are the sine and the cosine of the angle.

Warning
Do not apply this transformation in 2D
Parameters
[in,out]transformationtransformation that receive the transformation
[in]angleangle of rotation in radians

◆ add_rotation_z()

procedure mod_cg_transformation::t_cg_transformation::add_rotation_z ( class(t_cg_transformation), intent(inout) transformation,
double precision, intent(in) angle )

Compose by the following rotation matrix:

   !! ┌─────┬─────┬─────┬─────┐
   !! │  c  │ -s  │  0  │  0  │
   !! ├─────┼─────┼─────┼─────┤
   !! │  s  │  c  │  0  │  0  │
   !! ├─────┼─────┼─────┼─────┤
   !! │  0  │  0  │  1  │  0  │
   !! ├─────┼─────┼─────┼─────┤
   !! │  0  │  0  │  0  │  1  │
   !! └─────┴─────┴─────┴─────┘
   !! 

Where s and c are the sine and the cosine of the angle.

Parameters
[in,out]transformationtransformation that receive the transformation
[in]angleangle of rotation in radians

◆ add_scale()

procedure mod_cg_transformation::t_cg_transformation::add_scale ( class(t_cg_transformation), intent(inout) transformation,
double precision, dimension(:), intent(in) vector )

Compose by the following translation matrix:

   !! ┌─────┬─────┬─────┬─────┐
   !! │ sx  │  0  │  0  │  0  │
   !! ├─────┼─────┼─────┼─────┤
   !! │  0  │ sy  │  0  │  0  │
   !! ├─────┼─────┼─────┼─────┤
   !! │  0  │  0  │ sz  │  0  │
   !! ├─────┼─────┼─────┼─────┤
   !! │  0  │  0  │  0  │  1  │
   !! └─────┴─────┴─────┴─────┘
   !! 

Where sx, sy, and sz are the scaling factor in direction x, y, and z.

Parameters
[in,out]transformationtransformation that receive the transformation
[in]vectorarray containing the scaling factors per direction.

◆ add_scale_x()

procedure mod_cg_transformation::t_cg_transformation::add_scale_x ( class(t_cg_transformation), intent(inout) transformation,
double precision, intent(in) factor )

Compose by the following translation matrix:

   !! ┌─────┬─────┬─────┬─────┐
   !! │ sx  │  0  │  0  │  0  │
   !! ├─────┼─────┼─────┼─────┤
   !! │  0  │  1  │  0  │  0  │
   !! ├─────┼─────┼─────┼─────┤
   !! │  0  │  0  │  1  │  0  │
   !! ├─────┼─────┼─────┼─────┤
   !! │  0  │  0  │  0  │  1  │
   !! └─────┴─────┴─────┴─────┘
   !! 

Where sx is the scale factor in the direction x.

Parameters
[in,out]transformationtransformation that receive the transformation
[in]factorscaling factor in direction x.

◆ add_scale_y()

procedure mod_cg_transformation::t_cg_transformation::add_scale_y ( class(t_cg_transformation), intent(inout) transformation,
double precision, intent(in) factor )

Compose by the following translation matrix:

   !! ┌─────┬─────┬─────┬─────┐
   !! │  1  │  0  │  0  │  0  │
   !! ├─────┼─────┼─────┼─────┤
   !! │  0  │ sy  │  0  │  0  │
   !! ├─────┼─────┼─────┼─────┤
   !! │  0  │  0  │  1  │  0  │
   !! ├─────┼─────┼─────┼─────┤
   !! │  0  │  0  │  0  │  1  │
   !! └─────┴─────┴─────┴─────┘
   !! 

Where sy is the scale factor in the direction y.

Parameters
[in,out]transformationtransformation that receive the transformation
[in]factorscaling factor in direction y.

◆ add_scale_z()

procedure mod_cg_transformation::t_cg_transformation::add_scale_z ( class(t_cg_transformation), intent(inout) transformation,
double precision, intent(in) factor )

Compose by the following translation matrix:

   !! ┌─────┬─────┬─────┬─────┐
   !! │  1  │  0  │  0  │  0  │
   !! ├─────┼─────┼─────┼─────┤
   !! │  0  │  1  │  0  │  0  │
   !! ├─────┼─────┼─────┼─────┤
   !! │  0  │  0  │ sz  │  0  │
   !! ├─────┼─────┼─────┼─────┤
   !! │  0  │  0  │  0  │  1  │
   !! └─────┴─────┴─────┴─────┘
   !! 

Where sz is the scale factor in the direction z.

Warning
Do not apply this transformation in 2D
Parameters
[in,out]transformationtransformation that receive the transformation
[in]factorscaling factor in direction z.

◆ add_translation()

procedure mod_cg_transformation::t_cg_transformation::add_translation ( class(t_cg_transformation), intent(inout) transformation,
double precision, dimension(:), intent(in) vector )

Compose by the following translation matrix:

   !! ┌─────┬─────┬─────┬─────┐
   !! │  1  │  0  │  0  │ tx  │
   !! ├─────┼─────┼─────┼─────┤
   !! │  0  │  1  │  0  │ ty  │
   !! ├─────┼─────┼─────┼─────┤
   !! │  0  │  0  │  1  │ tz  │
   !! ├─────┼─────┼─────┼─────┤
   !! │  0  │  0  │  0  │  1  │
   !! └─────┴─────┴─────┴─────┘
   !! 

Where tx, ty, tz are the coordinates of the translation vector.

Parameters
[in,out]transformationtransformation that receive the transformation
[in]vectortranslation vector

◆ compose()

procedure mod_cg_transformation::t_cg_transformation::compose ( class(t_cg_transformation), intent(in) transformation,
type(t_cg_transformation), intent(inout) target )

Add a transformation to an other. Perform a matrix-matrix product.

Parameters
[in]transformationtransformation to add
[in,out]targettransformation that receive the transformation

◆ initialize()

procedure mod_cg_transformation::t_cg_transformation::initialize ( class(t_cg_transformation), intent(inout) transformation,
integer, intent(in) dimension )

The initialization results in the following matrix:

   !! ┌─────┬─────┬─────┬─────┐
   !! │  1  │  0  │  0  │  0  │
   !! ├─────┼─────┼─────┼─────┤
   !! │  0  │  1  │  0  │  0  │
   !! ├─────┼─────┼─────┼─────┤
   !! │  0  │  0  │  1  │  0  │
   !! ├─────┼─────┼─────┼─────┤
   !! │  0  │  0  │  0  │  1  │
   !! └─────┴─────┴─────┴─────┘
   !! 
Parameters
[in,out]transformationtransformation
[in]dimensionspatial dimension

◆ inverse_transform_direction()

procedure mod_cg_transformation::t_cg_transformation::inverse_transform_direction ( class(t_cg_transformation), intent(in) transformation,
double precision, dimension(:), intent(in) direction )

Return the transformed direction.

Parameters
[in]transformationtransformation
[in]directiondirection to transform

◆ inverse_transform_point()

procedure mod_cg_transformation::t_cg_transformation::inverse_transform_point ( class(t_cg_transformation), intent(in) transformation,
double precision, dimension(:), intent(in) point )

Return the transformed point.

Parameters
[in]transformationtransformation
[in]pointpoint to transform

◆ transform_direction()

procedure mod_cg_transformation::t_cg_transformation::transform_direction ( class(t_cg_transformation), intent(in) transformation,
double precision, dimension(:), intent(in) direction )

Return the transformed direction.

Parameters
[in]transformationtransformation
[in]directiondirection to transform

◆ transform_point()

procedure mod_cg_transformation::t_cg_transformation::transform_point ( class(t_cg_transformation), intent(in) transformation,
double precision, dimension(:), intent(in) point )

Return the transformed point.

Parameters
[in]transformationtransformation
[in]pointpoint to transform

The documentation for this type was generated from the following file: