Grasshopper

algorithmic modeling for Rhino

Anyone know how to construct a horizontal frame?  

I am trying to offset boundary curves from a planar brep internally to create a shelled region, but I can't figure out how to create a direction that will always go into the shape. Taking the boundary curves from the planar brep, the outside curve goes clockwise and the inner curves go anticlockwise, but if I create a frame at any point on the curve the y-axis are always pointing in the same direction:

Whereas if I use a horizontal frame in grasshopper:

There doesn't seem to be a method for making a horizontal frame in rhinocommon (or not that I've found), and I was wondering if anyone had any insight into how it is constructed?

Views: 4215

Replies to This Discussion

Ok, maybe I'm being a bit thick.  I'm looking at the string descriptions of the frame and the horizontal frame and it seems the only difference is that with the horizontal frame component both Z Parameters are aligned:

Is it something to do with changing the normal of the plane?

Horizontal frame is probably normal to the world Z axis, whereas the curve frame gets its normal some other way. One bare bones way you could reproduce horizontal frame would look like the following (C#, sorry if that's not your preferred flavor):

Plane horizFrame(Curve C, double t){

Vector3d Tangent = C.TangentAt(t);
Vector3d Perp = Vector3d.CrossProduct(Vector3d.ZAxis, Tangent);
Plane frame = new Plane(C.PointAt(t), Tangent, Perp);
return frame;
}

This assumes that your curves are all already parallel to the XY plane, otherwise you'll have to project the tangent vector to XY (or set its z component = 0) before the cross product.

Thanks Andrew! I was actually trying to do that method, but I didn't have the cross product of the z axis and tangent part.

Thanks again.  Works great.

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service