Re: Using affine transforms
Re: Using affine transforms
- Subject: Re: Using affine transforms
- From: vincent habchi <email@hidden>
- Date: Fri, 29 Apr 2011 17:26:28 +0200
Le 29 avr. 2011 à 17:01, McLaughlin, Michael P. a écrit :
> I am writing the drawRect routine for a custom view in which I need to draw
> a simple X-Y graph, given the data. Desiring to be elegant and up-to-date,
> I decided that the best (Cocoa) way to do this was to construct a scaling
> affine transform to change x,y coordinates into view coordinates using
>
> CGAffineTransform matrix = CGAffineTransformMakeScale(360/(x2 - x1), 240/(y2
> - y1));
[…]
I think this method has the drawback, as you said, to apply to the image as a whole, line width included.
Basically, if this helps, what I did for my simple GIS, where I also need to translate from one set of coordinates (geographical) to another (screen) was to use the Accelerate framework (CBLAS), that provides the dot product you're looking for and matrix multiplications to "concatenate" your various transforms. You can then compute the new coordinates and then draw directly to screen.
Vincent_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden