On 28/11/2009, at 10:37 AM, Shane wrote:

>> Why not just accumulate the points directly into NSBezierPath? It can be 
>> thought of as an array of points in a sense. Unless there's a compelling 
>> need to have the points themselves available in addition to the bezier path, 
>> just cut out the middle man (and it's not difficult to retrieve the points 
>> from a bezier path in any case).
> 
> Oops, possible duplication here, apologies ahead of time.
> 
> I liked the idea, but because my window can get resized and therefore,
> I'd have to rescale the points each and every time to fit my borders,
> I'm thinking using a middle man for this and just passing the
> NSPointArray might work better. Unless there's a better way.


Sure there is - you can transform a bezier path using an NSAffineTransform to 
scale it (and displace, rotate it) to wherever you want. You definitely 
shouldn't need to iterate over the points and perform a transformation on them 
yourself, unless you have some non-affine transformation in mind.

You can also set the scale for a view or any graphics context which will 
perform scaling for you.

The two approaches are similar but not identical. The first will transform the 
path itself, so if you  stroke it with, say a 2pt stroke, it will still be a 
2pt stroke on the scaled path. In the second case, the stroke will also be 
scaled.

I'm assuming that you want to draw the path, rather than just have a list of 
points for some other purpose? If not, then perhaps using a bezier path 
wouldn't be the best approach, but if you do intend to draw the path, I'd 
definitely use NSBezierPath.

--Graham


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to