Drawing an arc using CatmullRomSpline

895 views
Skip to first unread message

Lori Peck

unread,
Jun 24, 2015, 6:17:27 PM6/24/15
to cesiu...@googlegroups.com, Diana...@ngc.com, Lori A Peck (IS)
I am attempting to draw an Arc using a CatmulRomSpline.  I am setting 3 control points and then using evaluate to generate the points in between. I am evaluating 200 points which I thought would be enough.  The Arc displays, but appears flattened, a little more like an ellipse sector than a circle sector.  I have attached a document with the display using the points from the spline as well as points using our own function based upon a circle sector.

 1.  I see that there are firstTangent and lastTangent optional parameters.  Will these allow me to control the shape of the arc?  How are these used?  I cannot find an example.  I see that it is a Cartesian3 value rather than an angular based value.

2.  Do I need to set more control points?

3.  Should I be using a different type of spline or another method?

I appreciate you help with this.

Thanks,
Lori








Arcs.docx

Lori Peck

unread,
Jun 25, 2015, 1:11:07 PM6/25/15
to cesiu...@googlegroups.com, lori...@ngc.com, Diana...@ngc.com
I did some more research and experimented a little more.  I ended up adding more control points for the spline (1 before the center cp and after.  It did give me the curve I wanted..

Just for curiosity could I have don the same thing using the tangent inputs?

Lori

Daniel Bagnell

unread,
Jun 29, 2015, 8:06:44 PM6/29/15
to cesiu...@googlegroups.com, Diana...@ngc.com, lori...@ngc.com
You won't be able to create a circular arc with a Catmull-Rom spline. I think a Bezier spline could work as a pretty good approximation of a half circle. There is an implementation of Bezier splines in the splines branch. The only type of spline that I know can represent any length of a circular arc are NURBS. Though, they are complex and we don't have any plans on implementing them.

The tangents for the first and last points of the Catmull-Rom spline do affect the shape. If they aren't provided, we take a guess at good values based on the first/last three points. They are computed here. Let me know if you still decide to use Catmull-Rom splines and I can reply with an example.

Dan

Lori Peck

unread,
Jul 1, 2015, 5:10:28 PM7/1/15
to cesiu...@googlegroups.com, lori...@ngc.com, Diana...@ngc.com
I was able to use the Cesium Catmull-Rom spline class to draw the arc in the shape I needed.  I ended up supplying 2 more points.  One between the first and middle, and one between the middle and last.  These provided enough information on the shape of the curve I needed.  I then evaluated points inbetween to get my arc.

Regards,
Lori
Reply all
Reply to author
Forward
0 new messages