Grasshopper

algorithmic modeling for Rhino

The Homography transformation (or perspective transformation)

Couldn't find in Rhino and Grasshopper required instruments or commands, so wrote my own.


Small C# script computes a new point coordinates, perfoming a projective transformation.
Transformation requires two flat quadrilateral of which we take the coordinates of the corners. The first quadrilateral means the area that need to transform, the second - an area in which perfoms the transform. By moving corners of the second quadrilateral - we made the transformation.

INPUT PARAMETERS
The main functional element - highlighted with white node with a C# script.
"Tin" and "Tout" - for quadrangles corners,
"Pin" - points that need to be transformed.

USAGE
You can set 4 points manually for each quadrilateral and send them to the inputs of "Tin" and "Tout".
Or you can use your own rectangle, extract the coordinates of 4 corners, send them to the input of "Tin", bake them and immediately set these points from Rhino window to input "Tout". This method I implemented, the necessary blocks are marked in green and pink: the block "BAKE IT" and "SET MULTIPLE POINTS".
The script can operate only with the points, so if you want to transform curve - you need to convert it into points and then re-assemble.
For convenience, the second quadrilateral marked by a dotted line.

Views: 1296

Attachments:

Replies to This Discussion

Nice!

Very nice. Do you have developed also a spatial version? I am looking for a tool to transform spatial objects in again spatial objects as perspective transformation - relief perspective.


Hi, Leopold. No, i don't, but maybe this topic will be helpfull:

http://v5.rhino3d.com/forum/topics/cage-edit-tool-vs-scripting

I tried recreating it using the native GH.... not as elegant as a scripted component  but maybe has some use. You can always cluster it if it looks too ugly on the canvas.

Attachments:

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service