Arc center IJ

Hello I need add a arc with starPoint/endPoint and center ij :slight_smile:

                Rhino.Geometry.Point3d start = new Rhino.Geometry.Point3d(0, 0, 0);
                Rhino.Geometry.Point3d  end = new Rhino.Geometry.Point3d(0, 500, 0 );
                Rhino.Geometry.Point3d Center = new Rhino.Geometry.Point3d(-106, 250, 0);
                Rhino.Geometry.Arc arc = new Rhino.Geometry.Arc(start, Center, end);

There is any away?
There’s no such constructor. Simply rotate the vector start - center 90 degrees (or -90) and use starting point, tangent, end point.


Any pratic example?

Hi @MatrixRatrix,

Here is a Python sample. I’ll let you convert it to C#.

import System
import Rhino
import scriptcontext as sc

center = Rhino.Geometry.Point3d(-106.0, 250.0, 0.0)
start  = Rhino.Geometry.Point3d(0.0, 0.0, 0.0)
end = Rhino.Geometry.Point3d(0.0, 500.0, 0.0)


xaxis = start - center
radius = xaxis.Length

yaxis = Rhino.Geometry.Vector3d.CrossProduct(Rhino.Geometry.Vector3d.ZAxis, xaxis)

plane = Rhino.Geometry.Plane(center, xaxis, yaxis)

dir = end - center;

dot = Rhino.RhinoMath.Clamp(xaxis * dir, -1.0, 1.0)
angle = System.Math.Acos(dot)

yplane = Rhino.Geometry.Plane(plane.Origin, plane.YAxis)
dist = yplane.ValueAt(end)
if dist < 0.0:
    angle = (System.Math.PI * 2.0) - angle

arc = Rhino.Geometry.Arc(plane, radius, angle)



– Dale

Hello @dale

This is Ok, I only need the same function on C# for the radius?


Sorry , my mistake , is working, Thanks.

Hello @dale

I make some tries with some points with on same Y positon and the result is ok, the problem
is when the point is no the same Y positon like this:

On the right side it’s good, on the left side there should have been an arc like red line,
and the all original points is on 0 Z position, this arc have some diferent Z point.

this is my code:

               Rhino.Geometry.Point3d start = new Rhino.Geometry.Point3d(origemX, origemY, 
                Rhino.Geometry.Point3d  end = new Rhino.Geometry.Point3d(X, Y, Z );
                Rhino.Geometry.Point3d Center = new Rhino.Geometry.Point3d(I, J, K);

                var xaxis = start - Center;
                var radius = xaxis.Length;

                var yaxis = Rhino.Geometry.Vector3d.CrossProduct(Rhino.Geometry.Vector3d.ZAxis, 
                Rhino.Geometry.Plane plane =  new Rhino.Geometry.Plane(Center, xaxis, yaxis);

                var dir = end - Center;

                var dot = Rhino.RhinoMath.Clamp(xaxis * dir, -1.0, 1.0);
                var angle = System.Math.Acos(dot);

                Rhino.Geometry.Plane yplane = new Rhino.Geometry.Plane(plane.Origin, plane.YAxis);
                var dist = yplane.ValueAt(end);

                if (dist < 0.0)
                    angle = (System.Math.PI * 2.0) - angle;
                Rhino.Geometry.Arc arc = new Rhino.Geometry.Arc(plane, radius, angle);


Hi @MatrixRatrix,

I can’t help with what isn’t working without have a way to repeat (here) what you are seeing.

That said, here is another sample you might find helpful.


– Dale

 private void RunScript(Point3d start, Point3d center, Point3d end, ref object A)
    // Center must be restricted to the mediatrix of the start-end segment.
    // Otherwise it cannot be the center of an arc defined by its two ends.
    Plane plane = new Plane(start, end, center);
    Line ln = new Line((start + end) / 2, plane.YAxis, 1);
    center = ln.ClosestPoint(center, false);
    Vector3d vs = start - center;
    Vector3d ve = end - center;
    Vector3d nor = Vector3d.CrossProduct(vs, ve); 
    Vector3d tan = Vector3d.CrossProduct(nor, vs);
    A = new Arc(start, tan, end);


Thanks, I have mistake on start point , I have:
Rhino.Geometry.Point3d start = new Rhino.Geometry.Point3d(origemX, origemY, origemY);
Is supose:
Rhino.Geometry.Point3d start = new Rhino.Geometry.Point3d(origemX, origemY, origemZ);

@Dani_Abalde thank you.

hello @dale

I was working a little on your first example, and I have a problem that I am not able to solve.

The problem is when the arc direction reverses “clockwise and anticlockwise”,

Seams wend is “clockwise” the code make arc reverse to star/end point, I know beforehand if I want
clockwise or anticlockwise, what can i change?


Hi @MatrixRatrix,

The direction of an arc curve is counter-clockwise in relation to the plane on which it lies. In my initial Python sample, I used the world-xy plane.

– Dale