SolveSpace Logo SOLVESPACE -- parametric 2d/3d CAD
Examples
Tutorials
Features
Download
Reference
Technology
Library
Forum
Contact
USER FORUM

(you are viewing a thread; or go back to list of threads)

Circles vs cubic Beziers (by whitequark)
I thought that cubic Beziers could represent circles exactly (and indeed, aren't circles in SolveSpace represented in that way)? But the attached sketch shows a strange discrepancy between two. Why does this happen?
Sat Feb 20 2016, 21:21:07, download attachment bc.slvs
(no subject) (by Jonathan Westhues)
They can, and circles in SolveSpace are. User-sketched splines in SolveSpace are always non-rational, though, and circles are generally rational.
Sat Feb 20 2016, 22:59:54
(no subject) (by MikeM8891)
It looks like closed splines (and any spline that uses more than one mouse click to make) are represented as cubic splines, not cubic Bezier curves. As far as I can tell, a cubic Bezier curve can only represent a quarter circle. I attached an example.
Sun Feb 21 2016, 19:16:48, download attachment bezier.slvs
(no subject) (by Jonathan Westhues)
So for clarity, let's say "nonrational Bezier" or "rational Bezier" to represent a single nonrational or rational polynomial parametric curve segment defined using the Bernstein basis in terms of four control points, as the parameter goes from 0 to 1.

A rational Bezier can exactly represent an arc of a circle. There's nothing special about a quarter-circle. More rational Beziers per circle is slower because there are more pieces, but faster because the control points of the Beziers lie closer to the curve, improving the selectivity of coarse bounding box or convex hull tests. The representation is always exact, though. Four is a popular tradeoff, and that's what SolveSpace uses too.

A nonrational polynomial parametric curve cannot exactly represent a circle. It can very closely approximate one. More nonrational Beziers per circle improves the approximation, but it's never exact.

In SolveSpace, all curves drawn with Sketch -> Bezier Cubic Spline are nonrational, whether there's just one piece or multiple. If you make the chord tolerance very fine and zoom in then you'll see that, though the error is very small.
Sun Feb 21 2016, 20:39:32
(no subject) (by Jonathan Westhues)
Oh, and for completeness: the splines are C2, but that isn't necessarily the best global fit to some other curve. So hand-editing individual segments may get you a better fit than a spline with the same number of segments, as you observe.
Sun Feb 21 2016, 20:50:14
Post a reply to this comment:
Your Name:
Your Email:
Subject:
(no HTML tags; use plain text, and hit Enter for a line break)
Attached file (if you want, 5 MB max):
© 2008-2022 SolveSpace contributors. Most recent update June 2 2022.