Arc based on start, end, radius

Hi everyone,

Is there any component in Grasshopper that draws an arc based on start point, end point and the radius?
And if not, do you have any suggestions?
thanks in advancestart, end, radius

Most of the time simple thinks in Rhino have no counterpart in Grasshopper has in Grasshopper there is no user interaction (choice of a view, mouse movement …).
The best for you is to make a component from Arc SED (2 points and a vector) and calculate the vector depending on the plane, direction you want and radius.
Or use this plugin

1 Like

Use math to find the point if you choose start,end,radius or vector if you choose arc sed.
Of course a component to do that is better.

arc.gh (18.2 KB)

1 Like

How do you know it’s the short arc instead of the long one? What if you want that arc to be in a different plane?

I don’t understand what you mean by short and long arc.
It’s based on 2 points.

I wrote an algorithm, I know it’s not so clean and the shortest way, but for me it works…
But I can’t understand why the curve doesn’t shatter…ARC,Start,End,Radius.gh (18.3 KB)

An arc is part of a circle. So when you cut a circle at two points, you get two arcs. So even in 2d, two points and a radius actually describe two different circles and thus four different arcs. How do you pick between these four outcomes?

private void RunScript(Plane plane, Point3d start, Point3d end, double radius, ref object A, ref object B, ref object C, ref object D)
{
  var line = new Line(start, end);
  var vec = Vector3d.CrossProduct(line.Direction, plane.ZAxis);
  vec.Unitize();
  var d = Math.Sqrt(Math.Pow(radius, 2.0) - Math.Pow(line.Length, 2.0) / 4.0);
  A = new Arc(start, line.PointAt(0.5) + vec * (radius - d), end);
  B = new Arc(start, line.PointAt(0.5) - vec * (radius - d), end);
  C = new Arc(start, line.PointAt(0.5) + vec * (radius + d), end);
  D = new Arc(start, line.PointAt(0.5) - vec * (radius + d), end);
}

Arc.gh (5.9 KB)

2 Likes

I don’t cut a circle, i draw a line between two points than offset its middle point , the maximum offset is the Radius.
There is a mathematical relation between the middle point of arc and the radius which used to create it.

1 Like

This is a python component to create arc from 2 points and Radius

arc SER.ghpy (31.5 KB)


import rhinoscriptsyntax as rs
import math

if S and E:
    V = rs.VectorCreate(S,E)
    L = rs.VectorLength(V)
    
    if R < L/2 or R == None:
        R = L/2
    
    if D == True:
        if A == True:
            ang = math.degrees(math.asin(L/(2*R)))
        else:
            ang = math.degrees(-math.asin(L/(2*R)))
            
    else:
        if A == True:
            ang = math.degrees(math.asin(L/(2*R))-math.pi)
        else:
            ang = math.degrees(math.pi-math.asin(L/(2*R)))
            
            
    d = rs.VectorRotate(V,ang,[0,0,1])
    Arc = rs.AddArcPtTanPt(S,d,E)
    C = rs.ArcCenterPoint(Arc)
1 Like

Great as always,
thanks so much.

Hi, I try to use this function in my Grasshopper. I struggle to get an Arc output.
Screenshot 2021-04-14 102205

Any ideas what went wrong?

I can’t know without the file

This is the file. The left part makes problems. The right part was simply to double check the functionality.

ArcPPR.gh (11.7 KB)

It is a problem of output, you can fix it like that

ArcPPR_.gh (10.9 KB)

Thank you, that solved the issue.