Orient Direction is a tool which can perform 3 different transformations on geometry. You can Move, Rotate and Scale. In this example, I will be showing how you can do this by a point and a set of rectangles.
You can simply double-click on the canvas and search for “Ori”. There are two tools for orienting. One is Orient which actually transforms the geometry from a plane to another plane. Second is the “Orient Direction” which we will be talking about.
To start from scratch we can draw multiple geometries to see the orienting effect. We can easily array a rectangle or a square to have a grid of curves. I gave the array a 15 for row and column and a 1 for z-direction. The spacing of the squares is 5000 for each direction.
After creating the squares we can simply put a curve on the canvas (Params>Curve) and right click on it and choose “Set multiple curves” to import them into Grasshopper.
Later we need to define the Point A as the reference point and Point B as the target. Let’s assume that we don’t want to move the squares. In this case, both of the inputs should be the same! We can use an “Area”(Surface>analysis) to extract the squares centroid. You can also use “polygon center” (Curve>analysis).
To see the rotating squares, we should define “Direction A” and “Direction B”. By defining an “X vector” (Vector>Vector) we can say that we are using the x-direction as the turning handle of geometry (the blue vectors).If we define the red vectors as the target direction the squares will rotate to be aligned with it.
By using a point we can rotate the squares towards it. We use a “Vector 2PT” (Vector>vector) to easily define a target direction by two set of points. The start of the vector is the centroid of the squares and the target point is the point we defined earlier.
if we connect the resulting vector to “Direction B” we notice that the squares are scaled and rotate and the same time but the scale is so big that we cant have our desired results.
The problem is that “vector 2pt” will give us a vector with a length equal to the distance between the point and the centroids. And because the “Direction A” was a unit X vector, Grasshopper will compare the length of the vectors to define the scale factor. we can easily right click on unitize and set it to true to make the squares the same size.
To make the scaling effect more controllable we can change the unitize back to false (because we need the length of the vectors) and then use the “remap technique“(scroll down to see the white picture defining this technique) to control the scale.
We can use a “unit vector” (vector>vector) to unitize the direction but use the length of the remap.
By multiplying the unit vector and the remap we can have the desired result.
You can also change the minimum and maximum of the remap to have the bigger squares at the point. By defining a Graph mapper you can also change the scale even more.