Transformations

The following transformations are available to modify the scope of the current shape:

Relative Operator

For the t() and s() operations it is possible to conveniently transform the absolute values tx,ty,tz or sx,sy,sz to values relative to the scope size using the operator "'":

s('0.5, '1, '1)
t('2, 0, '3)

This is equal to:
s(0.5*scope.sx, 1*scope.sy, 1*scope.sz)
t(2*scope.sx, 0*scope.sy, 3*scope.sz)

Below are some examples; the next section explains the various coordinate systems used in the CGA Shape Grammar.

 

Examples

Setting the Size

Envelope
Lot-->
   extrude(10)
   s(5,5,5)

The extruded Lot is set to an absolute size of 5 units in all three dimensions.

Relative Resizing and Center

Envelope
Lot --> 
   s(’0.8, ’1, ’0.8) 
   center(xz) 
   extrude(20)
The scope is first sized down by using the s() operation in conjunction with the relative operator "'", then centered (relative to the scope of the Lot shape) and finally extruded to a 3D geometry.

Rotation and Center

Envelope
Lot-->
   extrude(18)
   split(y) { 
      2 : r(0, 360*split.index/split.total, 0)
          center(xyz) X
   }*

Each split shape is first rotated around its scope origin and then centered. Note: using

   r(scopeCenter, 
     0, 360*split.index/split.total, 0)
instead of the r() center() sequence gives the same result.

Translate - Rotation Concatenation


A-->
   primitiveCube()
   
This is the shape we start with.

A-->
   primitiveCube()
   t(2,0,0)
   
First a translation of two units along the x-axis.

A-->
   primitiveCube()
   t(2,0,0)
   r(0,30,0)
   
Then a rotation of 30 degrees around the y-axis.

A-->
   primitiveCube()
   t(2,0,0)
   r(0,30,0)
   t('2,0,0)
And another translation of 2 units along the x-axis.
Note:
  • translations are along the scope's x-axis, i.e. the rotation changes the global translation direction!
  • the relative operator ' is used - here it does not make a difference because scope.sx is 1

Copyright ©2008-2017 Esri R&D Center Zurich. All rights reserved.