Geometric modelling - xform

Dear Radiance enthusiasts,

I have a potentially trivial question.

I’ve been experimenting with xform and I realized that I am still quite confused about how it works in combination with -a (array).

Below I have listed two geometry generators, that seem similar but do not produce the same geometry.

!genbox leaf ref 0.1 0.1 3.5 | xform -t -0.05 -0.05 0.5 -t -14.168 -5 0 -a 15 -t 2.024 0 0 -a 6 -t 0 2.5 0 -rz -110

!genbox leaf ref 0.1 0.1 3.5 | xform -t -0.05 -0.05 0.5 -t -14.168 -5 0 -a 15 -t 2.024 0 0 | xform -a 6 -t 0 2.5 0 | xform -rz -110

It seems that when xform is applied only once, the two arrays mix producing a different final result.

Instead, when xform is repeated, the transformation is applied to the previously defined geometry. In other words, all previous transformations are performed and then rotation along the z-axis occurs.

Is my understanding correct?

I appreciate your time,

The correct interpretation of array arguments in xform is:

xform [initial xf] -a Na [outer xf] -a Nb [inner xf] -i 1 [final xf]

The “inner xf” happens Nb times before being affected by the “outer xf”, which is applied Na times. The “final xf” has to be preceded by “-i 1” to tell it not to be part of the inner array loop.

In your second command, where you pass the output of one xform into another, you end up swapping the inner and outer loops, which doesn’t really matter because Radiance doesn’t care about the order of geometry. However, you also took the “-rz -110” out of the original “-a 6” array, as if you had a “-i 1” between it and what preceeded. I think that’s the main difference.


Thank you so much Greg!

This is very helpful to ensure that my code becomes more readable and concise.

Wish you a pleasant day,