Been trying to work with arcs and circle objects this morning, and I’m having some trouble understanding how to do a few things… I would like to construct an arc from the following available data: center point, radius, start/end points (which I know are on the arc)… Obviously, there are two possible arcs here, that is not an issue at the moment, I can take care of that later.
I haven’t figured out how to construct the arc (Arc or ArcCurve) directly with this data - although I’m sure it’s possible…
The other direction I thought to try was to simply construct a circle with center and radius and split it at the two points. But Circle objects do not have a Split() method… I can certainly convert the circle object ToNurbsCurve() and split that at the points, but somehow there has to be a better, more “analytical” way…?
Anyway, for what I was doing, I worked around it differently, but I am now curious as to how to do this correctly…
Think of arcs as oriented planes with a radius and angle. The origin of the arc is always a point on the plane’s x-axis. The angle is measured from the x-axis counter-clockwise (as you’d expect). The radius should be obvious.
To create an arc from a point and radius, create a plane (world x-y will do). Set the origin of the plane to the point. Then use rs.AddArc.
For the second arc, you can use rs.AddArc3Pt, correct?
The RhinoCommon basis for all this is a Rhino.Geometry.Arc object. If you look at the online help, you will find lots of other construction methods.
An Arc is just a simple structure. The curve representation of an arc is a Rhino.Geometry.ArcCurve object. You can create one of these by passing a Rhino.Geometry.Arc object. Again, reference the help if you need. Using an ArcCurve, there will be no reason to ToNurbsCurve the arc…
Hi Mitch
What about this way … (in pseudo-code) ?
v1 = Vector( center_pt -> start_pt )
v2 = Vector( center_pt -> end_pt )
v3 = Unitize( v1 + v2 )
radius = Distance( center_pt, start_pt )
mid_pt = center_pt + v3 * radius
arc = Arc_3_Points( start_pt, mid_pt, end_pt )
… Assuming the arc is not 180 degrees …
( just an idea … I have not tried that … )
Cheers - emilio