I try to write a code for curve curve intersection like what it already has in grasshopper to be one of the components in c#. However, intersection function in rhino seems to work slightly different, yet critical to use as the picture below.
The question is how can I write the code in c# to be the same as CCX components in Rhino.
private void RunScript(Curve x, Curve y, double tol, double ov, ref object A)
{
var events = Rhino.Geometry.Intersect.Intersection.CurveCurve(x, y, tol, ov);
List pts = new List();
if (events != null)
{
for (int i = 0; i < events.Count; i++)
{
var ccx_event = events[i];
pts.Add(ccx_event.PointA);
if (ccx_event.PointA.DistanceTo(ccx_event.PointB) > double.Epsilon)
{
pts.Add(ccx_event.PointB);
}
}
}
Point3d[] result = Point3d.CullDuplicates(pts, 0.1);
A = result;
}