Skip navigation.
 
mlRe: NSBezierPath geometry question...
FROM : Nicko van Someren
DATE : Mon Apr 11 17:48:06 2005

On 11 Apr 2005, at 15:02, Serge Meynard wrote:

> But there's a simple error in your code. Here currPoint and nextPoint
> are the second and third points forming the current corner; drawing an
> arc between them won't produce what you want. The radius calculation
> you're making is probably fine, but the two points you provide to the
> arc method must lie on the circle, and you want them to be at 90
> degrees from each other. What you need for your arc points is a set of
> points at distance "radius" from currPoint; the first interpolated
> between currPoint and [path currentPoint], and the second interpolated
> between currPoint and nextPoint.


Not so.  The documentation for
appendBezierPathWithArcFromPoint:toPoint:radius: says:

   "The arc lies on the perimeter of a circle with radius radius
inscribed in an angle defined by the current point, fromPoint, and
toPoint. The arc is drawn between the tangent points of the circle with
the two legs of the angle. The arc usually does not contain the points
fromPoint and toPoint..."

So what is happening is that you draw a pair of straight lines  first
from the current end of the path to the "from" point and then from
there to the "to" point and then you tuck into the bend a circle of the
given radius.  Your arc is the section of the circle between the two
tangent points.  This means that if you are drawing curves around
right-angle bends then you want the "from" point to be the corner that
you would have gone to if you were drawing a proper 90 corner and the
"to" point to be somewhere along the straight line around the corner. 
As was noted elsewhere, a straight line segment is drawn from the
current end of the path to the tangent point where the arc starts but
there is not extension line to join the other end of the arc to the
"to" point.

   Nicko

Related mailsAuthorDate
mlNSBezierPath geometry question... Keith Blount Apr 10, 23:40
mlRe: NSBezierPath geometry question... Serge Meynard Apr 11, 00:37
mlRe: NSBezierPath geometry question... Robert Clair Apr 11, 13:01
mlRe: NSBezierPath geometry question... Keith Blount Apr 11, 13:17
mlRe: NSBezierPath geometry question... Serge Meynard Apr 11, 16:02
mlRe: NSBezierPath geometry question... Nicko van Someren Apr 11, 17:48
mlRe: NSBezierPath geometry question... Serge Meynard Apr 11, 18:41
mlRe: NSBezierPath geometry question... David Phillip Oste… Apr 11, 18:46
mlRe: NSBezierPath geometry question... Nicko van Someren Apr 11, 19:48
mlRe: NSBezierPath geometry question... Heinrich Giesen Apr 11, 20:49
mlRe: NSBezierPath geometry question... Robert Clair Apr 11, 21:02
mlRe: NSBezierPath geometry question... Keith Blount Apr 11, 21:19
mlRe: NSBezierPath geometry question... Scott Thompson Apr 11, 23:25
mlRe: NSBezierPath geometry question... Robert Clair Apr 11, 23:54
mlRe: NSBezierPath geometry question... Keith Blount Apr 12, 00:24
mlRe: NSBezierPath geometry question... Nicko van Someren Apr 12, 10:04
mlRe: NSBezierPath geometry question... Keith Blount Apr 12, 18:08
mlRe: NSBezierPath geometry question... Jonathon Mah Apr 13, 17:11