Re: NSBezierPath geometry question...
Re: NSBezierPath geometry question...
- Subject: Re: NSBezierPath geometry question...
- From: Nicko van Someren <email@hidden>
- Date: Mon, 11 Apr 2005 16:48:06 +0100
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
_______________________________________________
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