POV-Ray : Documentation : 1.2.7.4 Transform Identifiers
  POV-Ray 3.6 Documentation Online View  
1.2.7.3 Inverse Transform   1.2.7.5 Transforming Textures and Objects

1.2.7.4 Transform Identifiers

At times it is useful to combine together several transformations and apply them in multiple places. A transform identifier may be used for this purpose. Transform identifiers are declared as follows:

TRANSFORM_DECLARATION:
  #declare IDENTIFIER = transform{ TRANSFORMATION... } |
  #local IDENTIFIER = transform{ TRANSFORMATION... }

Where IDENTIFIER is the name of the identifier up to 40 characters long and TRANSFORMATION is any valid transformation modifier. See "#declare vs. #local" for information on identifier scope. Here is an example...

  #declare MyTrans =
    transform {
      rotate THISWAY
      scale SOMUCH
      rotate -THISWAY
      scale BIGGER
      translate OVERTHERE
      rotate WAYAROUND
    }

A transform identifier is invoked by the transform keyword with or without brackets as shown here:

  object {
    MyObject              // Get a copy of MyObject
    transform MyTrans     // Apply the transformation
    translate -x*5        // Then move it 5 units left
  }
  object {
    MyObject              // Get another copy of MyObject
    transform { MyTrans } // Apply the same transformation
    translate x*5         // Then move this one 5 units right
  }

On extremely complex CSG objects with lots of components it may speed up parsing if you apply a declared transformation rather than the individual translate, rotate, scale, or matrix modifiers. The transform is attached just once to each component. Applying each individual translate, rotate, scale, or matrix modifiers takes longer. This only affects parsing - rendering works the same either way.

1.2.7.3 Inverse Transform   1.2.7.5 Transforming Textures and Objects


Copyright 2003-2004 Persistence of Vision Raytracer Pty. Ltd.