Dear C# Friends!
I would like to divide a Curve and generate a list of Planes,
How could I align the planes as Gh Component Perp Frames does it?
I try to Rotate them (plane.Rotate) but How you could compute a delta Vector3d for all the planes?
Thanks!
private void RunScript(Curve curve, int n, bool alignPlanes, ref object A, ref object B, ref object C)
{
//Create an Array of Point3d
//var points = new Point3d[n+1];
Point3d[] points;
var p = curve.DivideByCount(n, true, out points);
List<Plane> planes = new List<Plane>();
List<Vector3d> vN = new List<Vector3d>();
// How to comoute a Delta Vector??
Vector3d vectorDelta = new Vector3d(Vector3d.ZAxis);
for (int i = 0; i < n + 1 ; i++){
vN.Add(curve.TangentAt(p[i]));
Plane plane = new Plane(points[i], vN[i]);
// HOw to align all the planes as Perp Frames Gh Component does?
if (alignPlanes){plane.Rotate(0, vN[i]);}
planes.Add(plane);
}
A = points;
B = vN;
C = planes;
private void RunScript(Curve curve, int n, ref object A, ref object B, ref object C)
{
// Create an empty array of planes
Plane planes = new Plane[n];
// Create an empty array of points
Point3d[] points;
// Divide curve into n
//// Curve.DivideByCount Method (Int32, Boolean,Point3d[])
//// https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Geometry_Curve_DivideByCount_1.htm
var t = curve.DivideByCount(n, true, out points); // T values
// Get Perpendicular planes
//// Curve.GetPerpendicularFrames Method
//// https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Geometry_Curve_GetPerpendicularFrames.htm
planes = curve.GetPerpendicularFrames(t);
A = t;
B = points;
C = planes;