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?
(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.
(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.
(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.
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.
(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.
Post a reply to this comment: