Mesh Cage Morph polylines


I am trying to use @DanielPiker Cage Morph component to morph series of polylines, but the result is off. Is it possible to morph to obtain a valid result?

What I am trying to find is a transformation matrix between two boxes not actual morphing that is possible via grasshopper.

One box is not deformed and the other is transformed using only shear and scale transformations in x,y,z axis. There is no twist, bending or taper , just shear and scale.

Is it at all possible to find both scale and shear transformation matrices for this simple cube case?
I honestly do not know where to start as I am searching for transformation matrix, not geometry output. (19.3 KB)

Hi Petras,

For the Mesh Cage Morph, if you scale the geometry being morphed by 0.9999, it works.

Points not strictly inside but lying exactly on faces/edges/vertices of the cage need special treatment.
I thought I’d included checks for all 3 of these cases, but it looks like I must have missed something - I’ll have another look.

I don’t see the connection with getting the transformation matrix though. The cage morph is generally not a transformation in that sense, and it doesn’t calculate any transformation matrices.

Thank you the scaling does the trick, I scaled up the initial reference cage then in the output I scaled the transformed geometry for the same value.

I was thinking if the box was transformed using only shear transformations, is it possible to get that transformation back for the case of simple cube.

Does the scaling affect in any way the distortion, for instance scale of 2 and 1.1 for the case of simple cube?

Also is it possible to know what is the logic in the component?
Would it work for quad and triangle meshes equally?

I believe that for a sheared cube it should be possible to calculate the affine transformation matrix directly from the 3 non orthogonal basis vectors (ie the vectors of 3 of the edges connected to one corner of your sheared target cube).

Mean value coordinates (what the MeshCageMorph uses) is probably overkill for this.
The component actually always works with triangles internally (quads get a point added in their center and turned into 4 triangles, to avoid causing bias by picking arbitrarily between the 2 diagonals if turning it into only 2 tris).
What’s this for?

I notice there’s even an overload for the ChangeBasis method in RhinoCommon that takes 3 reference and 3 target vectors:

Not sure if this actually handles shear and scaling though, or if it just fits a unit orthonormal frame to those vectors. Seems worth trying.

It does shear but not sure how that works: (25.7 KB)

It seems to me what the method calls the initial and final vectors are actually the wrong way round.
Swap them and it works (9.8 KB)

1 Like

Wow… that awesome simple method to do shear. Thank you very very much.
No idea what is the math behind but works so good.

1 Like