Matrix help: Need to move, rotate, scale and taper

Hi guys,
I am working on a tool to transform data from one map projection to another and I need to figure out how to make a transformation matrix, but this stuff is hard to understand.

Is there a tool where we can define the eight corners of a “cube” in two spaces and have a matrix generated from that?

Basically I need to figure out how to make a matrix for a situation like this where I know the corresponding corners:

( I presume flow along surface uses a complex version of this, thus the question)

Hi Holo,

Just to be 100% clear about your drawing, you are illustratinging a 3D rotation and not a taper? You only need to cater for the specific transforms in the title: move rotate and scale?

Regards
Jeremy

1 Like

No, it’s a taper.
Backstory:
I use pyproj to project the center of the bounding box + an offset of that center point.
Then I move the objects and rotates by evaluating the offsetpoints angle.

This works fine and fast, but I see I get a different result if I translate with pyproj every single point of the polylines, as there is a small taper involved. Thus the request to use a transformation matrix instead of move+rotate.

But I compared two maps that were “correctly” positioned and aligned from another software, and there they had only moved and rotated. No taper involved, and I think that might be a better solution so I don’t mess with too much data.

Baseline: I think I am good as it is, no need to over-perform. But it would be cool to know anyway though.

There’s a Transform output on every transformation component in grasshopper. You can use that to find the matrix.
Matrix
As Jeremy mentioned, matrices can only be used for Affine and Perspective transformations. Transformation matrices can’t do the following operations:

  • BendSpaceMorph
  • FlowSpaceMorph
  • MaelstromSpaceMorph
  • SplopSpaceMorph
  • SporphSpaceMorph
  • StretchSpaceMorph
  • TaperSpaceMorph
  • TwistSpaceMorph

You can also add two or more transformation matrices using the Compound component.

1 Like

Thanks, that explains a lot, also why shear was explained in the tutorial and not taper :slight_smile:

I believe that, technically, higher order transformations like taper can be applied via matrices if you are permitted to place formulae in the cells rather than constants. Whether Rhino can accommodate formulae I have no idea (I’m already well into territory where the mathematical part of my brain is hurting). Maybe @rajaa could answer that.

2 Likes

Well, then that’s obviously above mine too! So I’ll happily stick with move and rotate :wink: Thanks for taking the time though.

But if you find a way to make it easy to kind of transform stuff from one box to another then that could be a smooth tool for a select few in the future.

Maybe this?

SampleCsBoxMorph.cs

Easily ported to Python…

– Dale