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

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

    Vectors and
    Transformations

    Insert Menu Add-on
      & Download
 
                                           
"transform{ ... }" = bundled transformations
"transform{ ... invers }" = inverted transformations

With the transform statement it is possible to bundle a group of transformations like "scale", "rotate", "translate" and/or "matrix", in any wanted sequence by one single statement for all these transformations.

Syntax:
 #declare My_Trans
 = transform{ Free sequence of transformations}
  (Transformations here: translate, rotate, scale, or matrix.)
We use it like this:
 object{ My_Object transform My_Transformation }
//or by
 object{ My_Object transform {My_Transformation} }
  (with or without inner brackets!)
and the inverted transformation:
 object{ My_Object transform {My_Transformation inverse} } 
  (Needs the inner brackets!)

Here a example:
Sample canoes

An object called "Canoe" as well as the according hole in the surface of the water "Canoe_outside" is wanted to be placed i.e. in 3 different positions with different sizes / positions / orientations:

For this we first are defining the transformations, which lead to the wanted positions:
//------------------------------------- Positions:
#declare Canoe_Position1
  = transform { rotate< 0,30,0> translate<0.0,0,1>}
#declare Canoe_Position2
  = transform { rotate<-6,20,0> translate<1.5,0,5>}
#declare Canoe_Position3
  = transform { rotate<5, 0,0> scale 0.55
                          translate< -0.3,0,-2.00>}
//-------------------------------------------------
Then the canoes were placed there:

//---------------------- Canoes at their positions:
object{ Canoe transform Canoe_Position1}
object{ Canoe transform Canoe_Position2}
object{ Canoe transform Canoe_Position3}
//-------------------------------------------------
and also the according holes in the water:
//-------------------------------------------------
difference{
plane{<0,1,0>, 0 }
object{Canoe_outside transform Canoe_Position1 }
object{Canoe_outside transform Canoe_Position2 }
object{Canoe_outside transform Canoe_Position3 }
   texture{Polished_Chrome
                    normal {crackle 1 scale 5
                            turbulence 1
                            translate<0,0,5>}
                    finish {diffuse 0.9
                            reflection 0.40}}
          }// end of difference
//----------------------------------------------- end


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