Previous page Next page

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 without any 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.

Previous page Next page