• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSBezierPath geometry question...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSBezierPath geometry question...


  • Subject: Re: NSBezierPath geometry question...
  • From: Scott Thompson <email@hidden>
  • Date: Mon, 11 Apr 2005 16:25:21 -0500


On Apr 11, 2005, at 12:48 PM, Nicko van Someren wrote:

On 11 Apr 2005, at 17:46, David Phillip Oster wrote:

At 7:38 AM -0700 4/11/05, Robert Clair <email@hidden> wrote:
There is no cubic Bezier that is exactly a circular arc, the best you
can do is an approximation. However this isn't what you want - it's a
very bad approximation of an arc.

I've read this claim before but never understood it. Since a NSBezierPath is a cubic polynomial, why in the world would it have any trouble representing an arc, which is a quadratic polynomial?: just set the coefficients of the x^3 term to zero, and it IS a quadratic polynomial. (or in bezier speak: if the two off axis control points are in the same place, you've got a quadratic spline, which should be the same as a segment of arc.

The problem is that an arc is not a quadratic. The function for Y^2 is a quadratic in X but the function for Y is not.

The problem is not that Bézier curves, in general, cannot represent a circular arcs. There are categories of Bézier curves that can exactly represent circular arcs.


To be more accurate, you have to realize that the class of Bézier curves implemented on Mac OS X are a particular subset of the space of all Bezier curves. In particular they are Non-Rational Bezier curves.

(Mac OS X uses a form of Uniform Non-Rational B-Spline. Compare this with NURBS stands for Non-Uniform Rational B-Splines)

Unfortunately, the distinction between Rational and Non-rational points is not something I care to explain, but in essence, each point in space would be replaced by what amounts to a location and a "weighting factor". The curves used in Mac OS X all have a weighting factor of 1. If the system used Rational curves, the weights could be something other than 1.

With this additional information a more accurate statement is that a the Non-Rational Bézier curves used by Mac OS X cannot be used to represent a true circular arc. If you could construct Rational Bezier Curves they could represent circular arcs exactly.

The distinction is largely moot, however as you can add as many segments as you like. This basically means that you can approximate a circle to any error tolerance you care to. If we could ignore the limitations of things like memory, fixed precision math, etc... you could make the statement that for any error tolerance you gave me, I can construct a bezier curve that represents a circle to a closer value than your error tolerance.

When talking about graphics devices with discrete pixels, like display screens and even high-resolution image setters, you can represent a circle to within the size of a pixel which means that you can get "as close as the device will let you".

From the pedantic mathematical sense, however, it won't ever be a true circle.

Scott

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Re: NSBezierPath geometry question... (From: David Phillip Oster <email@hidden>)
 >Re: NSBezierPath geometry question... (From: Nicko van Someren <email@hidden>)

  • Prev by Date: Re: Command Line Arguments
  • Next by Date: problem disabling a menu item
  • Previous by thread: Re: NSBezierPath geometry question...
  • Next by thread: Re: NSBezierPath geometry question...
  • Index(es):
    • Date
    • Thread