Compound transformations


#1

What is the method behind the Compound Transformations component?
I have 5 transforms to combine before multiplying. Many thanks!


(David Rutten) #2

Transformations in Grasshopper are a bit different than Rhino or the usual mathematical approach (see below). However the Compound Transformations component takes a bunch of successive transformations and creates a single transformation which does the same thing. This means you only have to perform a potentially expensive (in terms of memory and processor cycles and inaccuracies) process only once.


Not important but maybe interesting:

Transformations in Rhino (and every other 3D software I know) are represented by 4x4 matrices. These matrices of 16 numbers can encode all possible linear transformations and combinations thereof. That is: translation (moving), dilation (scaling), reflection (mirroring), rotation, shearing and tapering (perspective shortening).

If you have one matrix which encodes a certain movement, another matrix which encodes a rotation about a specific axis, and a third matrix which encodes a scaling step, you’d be wasting time if you applied them all three in succession. Instead, you’d multiply the matrices together first, giving you a single matrix which does the exact same thing as all three. This is more efficient.

However when you combine matrices it becomes impossible to peel them apart again. Even a matrix representing a single operation (such as a rotation about 2 axes) is difficult to reverse engineer into meaningful individual steps. This is why Grasshopper ‘hides’ the matrix part and instead has different types of transformations that all retain all the meaningful data (axes and angles, centre-points and scale-factors, shearing-planes, etc.). When you compound these grasshopper transformations what you get is a list of successive individual transformations that can be easily segregated again. Of course behind the scenes matrices are kept and used, but on the user-interface level the transformations are presented as collections of meaningful operations.


Compound Transformations dissection
(Michael Pryor) #3

The compound transformation component description “Compound two transformations”. Is this an old description? It takes more than two.


(David Rutten) #4

Either that, or it was always a typo.


#5

Thanks David, and yes, big data going into optimisation routine so will need to have the compound first. Will have to apply elsewhere and the operation order will be translation, quaternion and dilation. Dusting off matrices maths. Thanks any ways. BTW compound component takes at least 7 ( max I tested ) and computes in less than 1 ms.