2009-11-03 12:47 PM
2009-11-04 05:19 PM
Anne wrote:Poor Norwegian husbands...
I tested out my husbands brain yesterday... (...) A friend of me told me today that her husband was really good in mathematics, so I have to test him😉
2009-11-04 07:02 PM
Anne wrote:Try the script below. I've typed this from memory, so it might have errors. Hopefully the comments make the meaning clear.
But the problem occures when I try to rotate the tilted circle counterclockwise around the z-axis. The angle is vinkeXZ. I can't figure out how to calculate the x-coordinates. I 've tryed many formulas, but the coordinates eighter give me an ellipsis or a line.
!----------------------------------------------------------- !Set up rotation angles ! xRotationAngle is rotation angle about X axis ! zRotationAngle is rotation angle about Z axis !----------------------------------------------------------- cosX = cos(-xRotationAngle) sinX = sin(-xRotationAngle) cosZ = cos(-zRotationAngle) sinZ = sin(-zRotationAngle) !Rotate a point about 'X' axis xIn = 20 yIn = 5 zIn = 0 gosub "doXRotate" !Rotate about 'Z' axis gosub "doZRotate" !The rotated point is contained in (xIn, yIn, zIn) end !----------------------------------------------------------- ! Rotate a point about the x axis ! In/Out: ! yIn: The Y coordinate of the point to rotate ! zIn: The Z coordinate of the point to rotate !----------------------------------------------------------- "doXRotate": yOut = zIn * sinX + yIn * cosX zIn = zIn * cosX - yIn * sinX yIn = yOut return !----------------------------------------------------------- ! Rotate a point about the z axis ! In/Out: ! xIn: The X coordinate of the point to rotate ! yIn: The Y coordinate of the point to rotate !----------------------------------------------------------- "doZRotate": xOut = xIn * cosZ + yIn * sinZ yIn = -xIn * sinZ + yIn * cosZ xIn = xOut return
2009-11-05 11:05 AM