Wednesday, October 12, 2011

Spatial Deform: Grasshopper Introduction

Rhino's CageEdit command's closest equivalent in grasshopper is Spatial Deform. The combination of an already powerful command with grasshopper's interactive nature makes this a very complicated and memory intensive tool to figure out and use. Other than this Q&A and this demo, I really can't find a good example of using Spatial Deform, so here goes a basic introduction:

To use Spatial Deform, you'll need to attach the following:
'G' - the rhino geometry to deform
'S' - a series of points that will define the cage
'F' - the forces applied to each of the points in 'S'
'f' - a falloff equation

Now this script takes advantage of Kangaroo's removeDuplicatePts. If you don't already have it, get it at their website.

This tutorial will teach you to deform a 3 dimensional object similar to rhino's CageEdit.

Cage Dimensions: 
1. Brep: Select the object(s). Let's start with one for now. 
2. BBox: Bounding Box will cage the 3-D geometry into a basic bounding box
3. Explode (Brep Components): will explode the bounding box into 6 surfaces
4. SDivide: split the 6 surfaces into an U by V array of grid points. !Note that it is flattened as output
4a and 4b: Slider # of U and V divisions, respectively.
5. removeDuplicatePts (Kangaroo): simplify the cage points by removing duplicates. 
6. Point: Select the attractor point. It will be incorporated in the next step to create a force on each of the cage points.

Force calculations: this secondary part is a demonstration of Deform with an attractor point. It will basically move the cage points as a group halfway to the attractor point.
7.  Average: finds the centroid of your bounding box
8. Point: attractor point. (Same as #6)
9. Vec2Pt (upper left): finds the vectors between each of the cage points and the centroid
10. Vec2Pt (lower left): finds the vector between the centroid and the attractor point
11. Vec2Pt (right): finds the vector to move all the object from the centroid to the attractor point
12. F1 (function): x/2: halves the moving force

Putting it together:
13. String: 1 : falloff set as 1. The default '1/x' produces some thorny and weird objects. Explore at your own risk.
14. Deform: add the inputs.
   -'G' from #1
   -'S' from #5
   -'F' from #12
   -'f' from #13


1 comment:

  1. Hi! this really looks well! but the links are broken, can i please have this demo?