Descriptions and Examples for the POV-Ray Raytracer by Friedrich A. Lohmüller
Geometric Transformations with POV-Ray -
Deutsch Deutsch
Italiano Italiano
Français français

Home
- POV-Ray Tutorial
  Geometric
  Transformations
   - Index

    Elementary
    Transformations
    - "translate<  ... >"
    - "rotate<  ... >"
    - "scale<  ... >"
    - mirror symmetry

    Other
    Transformations
    - "matrix<  ... >"
    - Shearing
    - transforms.inc
      - Shear_Trans(...)
      - Matrix_Trans(...)
      - Axial_Scale_Tr.
      - Rotate_Around
      - Axis_Rotate_Tr.
      - Reorient_Trans
      - Point_At_Trans
      - Center_Trans
      - min_+max_extent

    - "transform{ ...}"
       and "inverse"

    Vectors and
    Transformations
    - vrotate
    - vaxis_rotate
    - vtransform
    - vinv_transform
    - vturbulence
    - vnormalize
    - vcross
    - vdot()
    - vlength()
    - VAngle(), VAngleD()
    - VProject_Axis

    Insert Menu Add-on
      & Download
 
                                           
Transformations in "transforms.inc"
Some useful combinations of transformations are defined in the include file "transforms.inc". Before we are able to use them, we have to add (somewhere in the top part of our scene file) the following line to our text:
#include "transforms.inc"

Shear_Trans( New_X, New_Y, New_Z)
Multible Shearing:
Former x axis points to the vector New_X, y axis points to New_Y and z axis points to New_Z.
 Shear_Trans(< 2, 0.5,   0>,
             < 0, 0.5,   0>,
             < 0, 0.5, 0.5>) 
Shear_Trans example

Matrix_Trans( New_X, New_Y, New_Z, D)
Multible Shearing + Translation:
The former x axis points to the vector New_X, the y axis points to New_Y and the z axis points to New_Z and there is added a translation by the vector D.
 Matrix_Trans(< 2, 0.5,  0>,
              < 0, 0.5,  0>,
              < 0, 0.5,0.5>,
              <-0.5, 0, 0> ) 
Matrix_Trans example

Axial_Scale_Trans( Axis, Amount )
Stretching in the direction of an axis "Axis" by the factor "Amount"
 Axial_Scale_Trans(< 2,0,2>, 0.5)
               
Axial_Scale_Trans example

Rotate_Around_Trans
( <Rotate.x,Rotate.y,Rotate.z>, Center_of_Rotation )
Rotation with the rotation vector <Rotate.x,Rotate.y,Rotate.z> around the center "Center_of_Rotation".
Rotate_Around_Trans(<   0,  0, 20>,
                    < 1.5,0.5,  1>) 
Rotate_Around_Trans example

Axis_Rotate_Trans( Axis, Angle )
Rotation around an axis "Axis" by an angle of "Angle" (in degrees).
Axis_Rotate_Trans(< 1,0,2>, 110) 
Axis_Rotate_Trans example

Reorient_Trans( Axis_1, Axis_2 )
Reorientation by rotation of an axis "Axis_1" to a new axis "Axis_2".
Reorient_Trans(< 1,0,0>,
               < 1,0.0,2>) 
 Reorient_Trans example

Point_At_Axis( New_Y_Axis )
Reorientation by y axis points y axis along "New_Y_Axis".
#declare New_Y_Axis = <0.25,1,0.15>;
object{ MyObject
        Point_At_Trans( New_Y_Axis )}
Point_At_Axis example

Center_Trans( OBJECT , axis )
a) Centers a declared object 'OBJECT' in y direction.
Center_Trans( OBJECT , y )
Center_Trans example
a) Centers a declared object 'OBJECT' in x and y direction.
Center_Trans(OBJECT, x+y )
Center_Trans example
a) Centers a declared object 'OBJECT' in x, y and z direction.
Center_Trans(OBJECT,x+y+z)
Center_Trans example

No transformation, but often helpfull around transformations problems: (a built-in feature!)
min_extent( OBJECT_IDENTIFIER )
max_extent(OBJECT_IDENTIFIER)

This returns the minimum and maximum coordinates of a declared object or the corners of a bounding box for this object.
Attention: For CSG intersections and differences or isosurfaces the bounding box does not represent the actual dimensions of the object!
Center_Trans example
Demo of the bounding box:
object{ Wire_Box(min_extent(OBJECT),max_extent(OBJECT),0.05)
        pigment{ rgb<1,0.65,0>}
      } 
Length in x of the bounding box:
#declare Length_X =
                max_extent(OBJECT).x - min_extent(OBJECT).x;
Center of OBJECT:
#declare Center =
              0.5*( min_extent(OBJECT)+ max_extent(OBJECT));

The transformations shown here are also available as text templates in the section "Shearing & transform" in my "Insert Menu Add-on".

translate | rotate | scale | matrix | shearing | transforms.inc | transform | vector transformations
top
© Friedrich A. Lohmüller, 2013
www.f-lohmueller.de