Hello,
I need to solve the following problem for different setups of room
distributions.
Given are x and y values between 0 and 100:
0/100 100/100 | | x | | x |____________ 0/0 100/0
I would like to transform the same values mathematically in a way that
the result correspond to the coordinate system rotated 45 degrees
clockwise:
0/0---------0/100 | | x | | x | 100/0 100/100
Hopefully someone can help me with this. Many thanks in advance. Achim
Xnew = Yold Ynew = -Xold
?
dh.
Achim Bornhoeft a écrit :
Hello, I need to solve the following problem for different setups of room distributions.
Given are x and y values between 0 and 100:
0/100 100/100 | | x | | x |____________ 0/0 100/0
I would like to transform the same values mathematically in a way that the result correspond to the coordinate system rotated 45 degrees clockwise:
0/0---------0/100 | | x | | x | 100/0 100/100
Hopefully someone can help me with this. Many thanks in advance. Achim
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Hallo, Achim Bornhoeft hat gesagt: // Achim Bornhoeft wrote:
I need to solve the following problem for different setups of room
distributions.Given are x and y values between 0 and 100:
0/100 100/100 | | x | | x |____________ 0/0 100/0
I would like to transform the same values mathematically in a way that
the result correspond to the coordinate system rotated 45 degrees
clockwise:0/0---------0/100 | | x | | x | 100/0 100/100
Isn't this a rotation by 90 degrees shown here? :)
Anyway rotating a point is easier if you convert the coordinates to polar coordinates (radius and angle) first, then add the rotation angle to the current angle and convert back.
You could do the math yourself, but in Zexy there are some handy abstractions that do it for you: [cart2pol], [pol2cart] convert between cartesian (x,y) and polar (r, phi) coordinates:
x y | | [cart2pol] | | | [+ 0.785398] add rotation angle: 0.785398 is 45 degrees converted to rad | | [pol2cart] | | x' y'
The phi-angles are specified in rad, not in degrees. If you want to use degree for the rotation angle, the [deg2rad] object is helpful and it's also part of zexy. Or make your own: rad=deg*pi/180
Frank
Hello Frank, thank you for your prompt answer.
Am 07.07.2009 um 18:44 schrieb Frank Barknecht:
Hallo, Achim Bornhoeft hat gesagt: // Achim Bornhoeft wrote:
I need to solve the following problem for different setups of room distributions.
Given are x and y values between 0 and 100:
0/100 100/100 | | x | | x |____________ 0/0 100/0
I would like to transform the same values mathematically in a way
that the result correspond to the coordinate system rotated 45 degrees clockwise:0/0---------0/100 | | x | | x | 100/0 100/100
Isn't this a rotation by 90 degrees shown here? :)
Sure you're right.
Anyway rotating a point is easier if you convert the coordinates to
polar coordinates (radius and angle) first, then add the rotation angle to
the current angle and convert back.You could do the math yourself, but in Zexy there are some handy
abstractions that do it for you: [cart2pol], [pol2cart] convert between cartesian
(x,y) and polar (r, phi) coordinates:x y | | [cart2pol] | | | [+ 0.785398] add rotation angle: 0.785398 is 45 degrees
converted to rad | | [pol2cart] | | x' y'The phi-angles are specified in rad, not in degrees. If you want to
use degree for the rotation angle, the [deg2rad] object is helpful and it's
also part of zexy. Or make your own: rad=deg*pi/180
I tried this but without the results I expected. Probably it was not very clear how I explained it. See attached patch for a better description of what I am looking for.
Achim
Ciao
Frank
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
check: http://en.wikipedia.org/wiki/Rotation_matrix
On Tue, Jul 7, 2009 at 1:41 PM, Achim Bornhoeft achim@bornhoeft.org wrote:
Hello Frank, thank you for your prompt answer.
Am 07.07.2009 um 18:44 schrieb Frank Barknecht:
Hallo,
Achim Bornhoeft hat gesagt: // Achim Bornhoeft wrote:
I need to solve the following problem for different setups of room
distributions.
Given are x and y values between 0 and 100:
0/100 100/100 | | x | | x |____________ 0/0 100/0
I would like to transform the same values mathematically in a way that the result correspond to the coordinate system rotated 45 degrees clockwise:
0/0---------0/100 | | x | | x | 100/0 100/100
Isn't this a rotation by 90 degrees shown here? :)
Sure you're right.
Anyway rotating a point is easier if you convert the coordinates to polar
coordinates (radius and angle) first, then add the rotation angle to the current angle and convert back.
You could do the math yourself, but in Zexy there are some handy abstractions that do it for you: [cart2pol], [pol2cart] convert between cartesian (x,y) and polar (r, phi) coordinates:
x y | | [cart2pol] | | | [+ 0.785398] add rotation angle: 0.785398 is 45 degrees converted to rad | | [pol2cart] | | x' y'
The phi-angles are specified in rad, not in degrees. If you want to use degree for the rotation angle, the [deg2rad] object is helpful and it's also part of zexy. Or make your own: rad=deg*pi/180
I tried this but without the results I expected. Probably it was not very clear how I explained it. See attached patch for a better description of what I am looking for.
Achim
Ciao
-- Frank
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Hallo, Achim Bornhoeft hat gesagt: // Achim Bornhoeft wrote:
I tried this but without the results I expected. Probably it was not very clear how I explained it. See attached patch for a better description of what I am looking for.
Attached is a version which should do what you expect. I think you were just missing the correct translations of the center of rotation: It usually is the point (0,0), so if you want to rotate around a different center, like (50, 50) in your example, you first need to translate everything to (0,0). This is done in the [pd scale] and [pd unscale] subpatches by adding rsp. substracting 50.
Frank