Hi,
I am constructing an arc through points and cut it with the XY-Plane.
I want to stay with the upper half, but it remains the lower one.
Could someone explain what I am doing wrong?
Thanks
private void RunScript(List<Vector3d> vec, ref object A)
{
var points = new List<Point3d>(vec.Count);
foreach (Vector3d vector in vec)
{
Point3d pt = new Point3d(vector);
points.Add(pt);
}
Sphere sphere = Sphere.FitSphereToPoints(points);
Plane plane = new Plane();
Plane.FitPlaneToPoints(points, out plane);
Circle circle = new Circle();
Rhino.Geometry.Intersect.Intersection.PlaneSphere(plane, sphere, out circle);
double a ; double b;
var doubles = new List<double>(2);
Rhino.Geometry.Intersect.Intersection.PlaneCircle(Plane.WorldXY, circle, out a, out b);
doubles.Add(a);
doubles.Add(b);
Curve cirNrbs = circle.ToNurbsCurve();
Curve[] crvs = cirNrbs.Split(doubles);
for (int i = 0; i < 2; i++)
{
Point3d midPt = crvs[i].PointAtNormalizedLength(0.5);
if (midPt.DistanceTo(Plane.WorldXY.Origin) > 0)
{
Curve upperArc = crvs[i];
A = upperArc;
}
}
file:arcSide.gh (3.3 KB)