Re: Rotation problem
Re: Rotation problem
- Subject: Re: Rotation problem
- From: "Shawn Erickson" <email@hidden>
- Date: Fri, 10 Nov 2006 15:03:49 -0800
On 11/10/06, Linea Tessile srl <email@hidden> wrote:
aff = [NSAffineTransform transform];
[aff translateXBy:-(center.x) yBy:-(center.y)];
aff1 = [NSAffineTransform transform];
[aff1 rotateByDegrees:-grado];
[aff appendTransform:aff1];
aff2 = [NSAffineTransform transform];
[aff2 translateXBy: center.x yBy: center.y];
[aff appendTransform:aff2];
Don't have an answer to your issue (hard to understand what you are
finding incorrect...) but I wanted to note that the above code it more
difficult then it needs to be. The code could be as simple as the
following:
NSAffineTransform* aff = [NSAffineTransform transform];
[aff translateXBy:-(center.x) yBy:-(center.y)];
[aff rotateByDegrees:-grado];
[aff translateXBy:center.x yBy:center.y];
Additionally the following code seem strange to me...
int xVal,yVal;
float x,y;
...
x = PX2MM(((punto->x) - centerX));
y = PX2MM(((punto->y) - centerY));
NSString *xs = [NSString stringWithFormat:@"%.f", x];
NSString *ys = [NSString stringWithFormat:@"%.f", y];
xVal = [xs intValue];
yVal = [ys intValue];
You can assign a float variable to an integer variable directly, no
need to use an NSString instance in between as you appear to be doing.
xVal = x;
yVal = y;
If you want a particular rounding behavior consider using rintf(),
roundf(), ceilf(), floorf(). You can find more information on those by
using "man rintf", etc. in the Terminal.
I cannot follow what exactly you are attempting to do but I believe
you should be able to transform the whole bezier path instead of
having to do each point (consider -[NSBezierPath
transformUsingAffineTransform:]. Or possibly avoid the use of bezier
path by using -[NSAffineTransform transformPoint:].
-Shawn
_______________________________________________
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