public static Tuple <Point3d, Point3d> CurveCurveIntersectionPoints(Curve C0, Curve C1, double t) { Rhino.Geometry.Intersect.CurveIntersections ci = Rhino.Geometry.Intersect.Intersection.CurveCurve(C0, C1, t, t); Line line = Line.Unset; if (ci.Count > 0) { Rhino.Geometry.Intersect.IntersectionEvent intersection = ci[0]; return(new Tuple <Point3d, Point3d>(intersection.PointA, intersection.PointB)); } return(null); }
public static Tuple <double, double> CurveCurveInter(Curve C0, Curve C1, double t) { Rhino.Geometry.Intersect.CurveIntersections ci = Rhino.Geometry.Intersect.Intersection.CurveCurve(C0, C1, t, t); Line line = Line.Unset; if (ci.Count > 0) { Rhino.Geometry.Intersect.IntersectionEvent intersection = ci[0]; return(new Tuple <double, double>(intersection.ParameterA, intersection.ParameterB)); } return(null); }
public static Tuple <double, double> CurveCurveIntersection(Curve C0, Curve C1, double t) { //Rhino.RhinoApp.WriteLine("WTF"); Rhino.Geometry.Intersect.CurveIntersections ci = Rhino.Geometry.Intersect.Intersection.CurveCurve(C0, C1, t, t); Line line = Line.Unset; if (ci.Count > 0) { Rhino.Geometry.Intersect.IntersectionEvent intersection = ci[0]; //Rhino.RhinoApp.WriteLine(intersection.ParameterA.ToString() +" " + intersection.ParameterB.ToString()); return(new Tuple <double, double>(intersection.ParameterA, intersection.ParameterB)); } return(null); }
/// <summary> /// This is the method that actually does the work. /// </summary> /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param> protected override void SolveInstance(IGH_DataAccess DA) { ///////////////////////////////////////////////////////////////////////////////////////////////////声明变量 Curve curveA = null; List <Curve> curveB = new List <Curve>(); ///////////////////////////////////////////////////////////////////////////////////////////////////检测输入端是否合理 if (!DA.GetData(0, ref curveA)) { return; } if (!DA.GetDataList(1, curveB)) { return; } List <Point3d> pts = new List <Point3d>(); Curve[] crs; for (int i = 0; i < curveB.Count; i++) { Rhino.Geometry.Intersect.CurveIntersections cin = Rhino.Geometry.Intersect.Intersection.CurveCurve(curveA, curveB[i], 0, 0); int mm = cin.Count; if (mm >= 1) { Rhino.Geometry.Intersect.IntersectionEvent[] evt = new Rhino.Geometry.Intersect.IntersectionEvent[mm]; for (int k = 0; k < mm; k++) { evt[k] = cin.ElementAt(k); pts.Add(evt[k].PointA); } } } List <double> ts = new List <double>(); if (pts.Count >= 1) { for (int j = 0; j < pts.Count; j++)////点在curve上的t值 { double t = 0; curveA.ClosestPoint(pts[j], out t); ts.Add(t); } } crs = curveA.Split(ts); DA.SetDataList(0, crs); }
public static CCX CurveCurveIntersectionCCX(Curve C0, Curve C1, double t) { Rhino.Geometry.Intersect.CurveIntersections ci = Rhino.Geometry.Intersect.Intersection.CurveCurve(C0, C1, t, t); Line line = Line.Unset; if (ci.Count > 0) { Rhino.Geometry.Intersect.IntersectionEvent intersection = ci[0]; return(new CCX() { t0 = intersection.ParameterA, t1 = intersection.ParameterB, p0 = intersection.PointA, p1 = intersection.PointB }); } return(null); }