static public bool CreateSections(Rhino.RhinoDoc doc, Rhino.Geometry.GeometryBase geo, Rhino.Geometry.Surface surfaceB, Rhino.Geometry.Curve curve, double interval, ref List <PlanePoint> points) { Rhino.Geometry.Interval domain = curve.Domain; // fixed issue for (double t = domain.T0; t < domain.T1; t += interval) { Rhino.Geometry.Point3d pt = curve.PointAt(t); Rhino.Geometry.Vector3d tangent = curve.TangentAt(t); Rhino.Geometry.Vector3d curvature = curve.CurvatureAt(t); Rhino.Geometry.Plane plane = new Rhino.Geometry.Plane(); curve.FrameAt(t, out plane); doc.Objects.AddPoint(pt); curvature = curvature * 10.0; Rhino.Geometry.Line line = new Rhino.Geometry.Line(pt, curvature); doc.Objects.AddLine(line); RhinoApp.WriteLine("Curve at {0}", t); Rhino.Geometry.Vector3d normal = new Rhino.Geometry.Vector3d(); bool ret = false; if (geo is Rhino.Geometry.Brep) { Rhino.Geometry.Brep brepA = (Rhino.Geometry.Brep)geo; ret = GetNormalVector(brepA, pt, ref normal); RhinoApp.WriteLine(" Added Brep point at ({0}, {0}, {0})", pt.X, pt.Y, pt.Z); } else if (geo is Rhino.Geometry.Surface) { Rhino.Geometry.Surface surfaceA = (Rhino.Geometry.Surface)geo; ret = GetNormalVector(surfaceA, pt, ref normal); RhinoApp.WriteLine(" Added surface point at ({0}, {0}, {0})", pt.X, pt.Y, pt.Z); } if (ret) { Rhino.Geometry.Vector3d ucoord = CrossProduct(tangent, normal); Rhino.Geometry.Plane plane2 = new Rhino.Geometry.Plane(pt, ucoord, tangent); // normal); double[] parameters = plane2.GetPlaneEquation(); PlanePoint PlanePoint = new PlanePoint(); PlanePoint.pt = pt; PlanePoint.A = parameters[0]; PlanePoint.B = parameters[1]; PlanePoint.C = parameters[2]; PlanePoint.D = parameters[3]; PlanePoint.curvature = curvature; points.Add(PlanePoint); Rhino.Geometry.Interval Interval1 = new Rhino.Geometry.Interval(-0.1, -0.1); Rhino.Geometry.Interval Interval2 = new Rhino.Geometry.Interval(0.1, 0.1); Rhino.Geometry.PlaneSurface PlaneSurface = new Rhino.Geometry.PlaneSurface(plane2, Interval1, Interval2); doc.Objects.AddSurface(PlaneSurface); } } return(true); }
/// <summary> /// Create FdCoordinateSystem from Rhino plane on curve mid u-point. /// </summary> internal static FdCoordinateSystem FromRhinoCurve(this Rhino.Geometry.Curve obj) { // reparameterize if neccessary if (obj.Domain.T0 == 0 && obj.Domain.T1 == 1) { // pass } else { obj.Domain = new Rhino.Geometry.Interval(0, 1); } // get frame @ mid-point Rhino.Geometry.Plane plane; obj.FrameAt(0.5, out plane); return(plane.FromRhinoPlane()); }