Democratic Underground Latest Greatest Lobby Journals Search Options Help Login
Google

MATH SUCKS!

Printer-friendly format Printer-friendly format
Printer-friendly format Email this thread to a friend
Printer-friendly format Bookmark this thread
This topic is archived.
Home » Discuss » The DU Lounge Donate to DU
 
ZombieNixon Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 01:47 AM
Original message
MATH SUCKS!
And this isn't good math, it's Man math, like 3D vector calculus (and by "man" math, I don't mean that only guys can do it, because I'm a guy and I can't x(, I mean it's the math the Man uses to torture you with). How the hell do you get a computer to process object rotation in such a way that the axes don't end up on top of each other?! :grr: They say to make it one rotation about an arbitrary axis, but they don't tell you how to get the axis or the angle! x(

I want sympathy, but it has to be esoteric. No math proles!








:hide:
Printer Friendly | Permalink |  | Top
Crazy Guggenheim Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 01:49 AM
Response to Original message
1. Dumb ass. Try it in Spherical coordinates.
Edited on Thu Feb-16-06 01:49 AM by Crazy Guggenheim
:popcorn: :popcorn:
Printer Friendly | Permalink |  | Top
 
ZombieNixon Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 01:50 AM
Response to Reply #1
2. ...
w = (cos(theBone->rot.x/2)*cos(theBone->rot.y/2)*cos(theBone->rot.z/2))-
(sin(theBone->rot.x/2)*sin(theBone->rot.y/2)*sin(theBone->rot.z/2));
rotAngle = 2*acos(w);
Q3Point3D_Vector3D_Add(&worldOrigin,&theBone->coord,&rotPoint);
Q3Matrix4x4_SetRotateAboutAxis(&matrix,&rotPoint,&theBone->rot,rotAngle);
Q3Matrix4x4_Multiply(&theBone->baseGroupTransforms,&matrix,&theBone->baseGroupTransforms);

That is all.

:popcorn:
Printer Friendly | Permalink |  | Top
 
Crazy Guggenheim Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 01:51 AM
Response to Reply #2
4. It's been a few years ..........
:popcorn:
Printer Friendly | Permalink |  | Top
 
ZombieNixon Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 01:53 AM
Response to Reply #4
6. That not only does the wrong rotation,
it makes the object scale do fucked up things too! x(
Printer Friendly | Permalink |  | Top
 
billyskank Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 12:35 PM
Response to Reply #2
40. Try the matrix determinant method
:popcorn:
Printer Friendly | Permalink |  | Top
 
ZombieNixon Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 12:39 PM
Response to Reply #40
41. Which is...?
I'm essentially self-taught; I don't know all your crazy British names for these things. ;)

But seriously, what is that?
Printer Friendly | Permalink |  | Top
 
billyskank Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 02:24 PM
Response to Reply #41
46. I don't remember
All I remember is, I used it one time when I was writing a 3D graphics program. I had my polygons defined and I needed a way of finding the normals to all of them, so that I could do the dot product between the normal and the light vector, thus obtaining the shading coefficient of the surface. The matrix determinant method was how I calculated the normals. No idea how it worked though, and I'm sure it isn't relevant. I was just being an asshole. ;)
Printer Friendly | Permalink |  | Top
 
ZombieNixon Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 04:14 PM
Response to Reply #46
48. ...
x(

However, I'm sure I'll end up using it at one point or another. I'm writing a 3D game engine. This bug's in the skeleton animation routines. :hi:
Printer Friendly | Permalink |  | Top
 
ZombieNixon Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 01:50 AM
Response to Reply #1
3. How do you resolve those back into x-y-z angles?
Printer Friendly | Permalink |  | Top
 
Crazy Guggenheim Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 01:54 AM
Response to Reply #3
8. It's just x = cos(theta) y = Sin(omega) z=cos(theta)sin(omega) or
something like that.

:popcorn:
Printer Friendly | Permalink |  | Top
 
ZombieNixon Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 01:56 AM
Response to Reply #8
10. Yeah, I did something like that.
It didn't work. x( But, I will try it again and perhaps get the math right this time.




Tomorrow.
Printer Friendly | Permalink |  | Top
 
Crazy Guggenheim Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 01:57 AM
Response to Reply #10
11. Sorry I couldn't remember.
:popcorn:
Printer Friendly | Permalink |  | Top
 
ZombieNixon Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 01:59 AM
Response to Reply #11
14. No, it's all right. I have it written down somewhere.
I just don't feel like looking it up right now.

:popcorn:
Printer Friendly | Permalink |  | Top
 
deadparrot Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 01:53 AM
Response to Original message
5. I'm finished with math after this semester.
I'll never get a job (history/political science double major), but who the hell cares? No more math! :woohoo:

If necessity is the mother of invention
Then I'd like to kill the guy who invented this
The numbers come together in some kind of 3rd dimension
A regular algebraic bliss.
Let's start with something simple
Like one and one ain't three
And two plus two will never get you five
There's fractions in my subtraction
And X don't equal Y
But my homework is bound to multiply

Math sucks (math sucks)
Math sucks (math sucks)
I'd like to burn this textbook, I hate this stuff so much!
Math sucks (math sucks)
Math sucks (math sucks)
Sometimes I think that I don't know that much--But math sucks!

I got so bored with my homework
I turned on the T.V.
The beauty contest winners were all smiling through their teeth
They asked the new Miss America "Hey babe, can you add up all those bucks?"
She looked puzzled then just said, "Math Sucks!"

Math sucks (math sucks)
Math sucks (math sucks)
You don't even have to spell it, all you have to do is yell it
Math sucks (math sucks)
Math sucks (math sucks)
Sometimes I think that I don't know that much--But math sucks!

Geometry, trigonometry, and if that don't tax your brain
There are numbers to big to be named (too big to be named)
Numerical precision is a science with a mission
And I think it's gonna drive me insane

Parents fighting with their children and the Congress can't agree,
Teachers and their students are all jousting constantly
Management and labor keep rattling old sabers,
Quacking like those Peabody ducks

Math sucks (quack quack)
Math sucks (quack quack)
You don't even have to spell it, all you have to do is yell it!
Math sucks (math sucks)
Math sucks (math sucks)
Sometimes I think that I don't know that much--But math sucks!

Math sucks, math sucks, math sucks the big one
Math sucks, math sucks, math sucks the big one
Printer Friendly | Permalink |  | Top
 
ZombieNixon Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 01:57 AM
Response to Reply #5
13. I don't have to take any more math classes, and I might
test out of programming, since I have enough self-taught experience that I can teach others (seriously, I'm not trying to brag, but I'm pretty damn good), yet the math is killer! x( x( x(
Printer Friendly | Permalink |  | Top
 
Moochy Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 11:03 PM
Response to Reply #13
67. You are probably getting a precision error
when rotating the world and translating you gotta do it juuuust right, or you get the skewing you describe. Are you using enough precision?

I'm not a 3d programmer, but I recognize the error you are describing, from friends who do know the math, and have worked on 3d programming at various companies. (NovaLogic, for one)

If you use say an integer or something besides a double for your rotate operations, then you get the skewing and resizing funkieness after just a few transformations. I know that this doesnt help, but I figured I'd chime in with a, hey I've heard of that problem before post :)
Printer Friendly | Permalink |  | Top
 
ZombieNixon Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 11:06 PM
Response to Reply #67
68. I'm using floats.
I suppose I could type cast it as a double, but I don't know if that would do any good.

It seems to be more of an effect of the object space axes of the parent and child bones not always lining up a) with each other and b) with world axes.
Printer Friendly | Permalink |  | Top
 
Moochy Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 11:17 PM
Response to Reply #68
69. Uncanny resemblance to my friends' problem.
Edited on Thu Feb-16-06 11:18 PM by Moochy
Casting your coordinates as doubles, won't help if the API is expecting a float, unless you retain the precision post transform.

It's an uncanny description of the problem my friend described, where his 3d model parts, the positions of which were stored using polar coordinates relative to the main object body, using some kind of an Inverse Kinematic join to the main object, ie. arms /turrets etc. would flail around randomly or quiver when the object was translated in small amounts, but would begin to really wack out quickly, because of the lack of precision in the transform API. Their solution was to spin the camera, but it was a kludge fix. In his case I'm pretty sure their API was using integer math for speed, and they truncated precision at like 10 digits, instead of using a slower, big double.

As he described the work around, was to do some matrix math, And I think he lost me at that point. :)
Printer Friendly | Permalink |  | Top
 
SofaKingLiberal Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 01:53 AM
Response to Original message
7. Check out the forums here:
Printer Friendly | Permalink |  | Top
 
Crazy Guggenheim Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 01:55 AM
Response to Reply #7
9. That's a good one!!
:popcorn:
Printer Friendly | Permalink |  | Top
 
jpgray Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 01:57 AM
Response to Original message
12. This is a hyperbolic tangent of a post
:eyes:
Printer Friendly | Permalink |  | Top
 
ZombieNixon Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 02:01 AM
Response to Reply #12
15. You're a scalene ellipsoidal projection of a DUer!
:P
Printer Friendly | Permalink |  | Top
 
jpgray Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 02:02 AM
Response to Reply #15
17. Kiss my apogee.
Printer Friendly | Permalink |  | Top
 
Rabrrrrrr Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 02:01 AM
Response to Original message
16. Bullshit! Math is the language of God, and there is little that is better.
Math is nirvana!

And I'm with the first poster - do it in spherical coordinates.

Printer Friendly | Permalink |  | Top
 
ZombieNixon Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 02:05 AM
Response to Reply #16
18. Yeah, I'll give that another shot.
Problem is rotation has to be resolved as a vector, so the transformation applied to vectors isn't a rotation but some kind of fucked up translation since tha axes switch all over the place. The spherical thing should work if I apply it right. x(
Printer Friendly | Permalink |  | Top
 
JVS Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 02:14 AM
Response to Reply #16
22. Language of God yes, but His voice is hard to bear
"But now, why should we die? This great fire will consume us, and we will die if we hear the voice of the LORD our God any longer." --Deuteronomy 5:25
Printer Friendly | Permalink |  | Top
 
ZombieNixon Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 02:20 AM
Response to Reply #22
25. Actually, it's more like this:
Deuteronomy(5,25)

void Deuteronomy(int par, int subPar)
{
unsigned long now;
typedef struct
{
Byte what;
}Hear;

typedef struct
{
double voice;
}God;

now = GetDateTime();

while(true)
{
switch(Hear.what)
{
case God.voice;
Die();
break;

default:
;
}
}
}

void Die(void)
{
ExitToShell();
}
Printer Friendly | Permalink |  | Top
 
Heidi Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 11:13 AM
Response to Reply #16
35. It's art, too.
I believe Twombly would agree.
Printer Friendly | Permalink |  | Top
 
WritingIsMyReligion Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 05:34 PM
Response to Reply #16
54. Math sounds like screeching banshee-wailing to me...
Edited on Thu Feb-16-06 05:36 PM by WritingIsMyReligion
I'm good at it, but it is Just. So. Fucking. Dull.

Gaaaah...

:D :D :P
Printer Friendly | Permalink |  | Top
 
amitten Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 02:05 AM
Response to Original message
19. I know how to bake things.
:yoiks:
Printer Friendly | Permalink |  | Top
 
ZombieNixon Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 02:06 AM
Response to Reply #19
20. That's cool!
Can you make me some cookies? I'm hungry. Pleeeze?
Printer Friendly | Permalink |  | Top
 
Rabrrrrrr Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 02:07 AM
Response to Reply #20
21. Yes, amitten, make cookies! But make them Tesseracts!
Thanks!
Printer Friendly | Permalink |  | Top
 
amitten Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 02:19 AM
Response to Reply #21
24. I don't stock enough flour for that.
:yoiks:
Printer Friendly | Permalink |  | Top
 
amitten Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 02:19 AM
Response to Reply #20
23. Only if you promise to stop posting math problems.
You gave me a case of the hives!
Printer Friendly | Permalink |  | Top
 
ZombieNixon Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 02:21 AM
Response to Reply #23
26. I gave *me* a case of the hives!
That's how irritating this problem is!!! :grr: :yoiks:
Printer Friendly | Permalink |  | Top
 
tjwmason Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 04:58 AM
Response to Original message
27. A joke from my time at university.
Why did the arts faculty student only open one curtain in the morning?

So that they'd have something to do in the afternoon.

HAHAHAHAHAHAHAHAHA

It's your choice to do sciency stuff matey. :P
Printer Friendly | Permalink |  | Top
 
mzteris Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 08:44 AM
Response to Reply #27
28. A Chemist and a mathematician get married
Their son's nickname is Iron59 -

what's his real name?



Printer Friendly | Permalink |  | Top
 
ProfessorGAC Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 09:37 AM
Response to Reply #28
30. Ferris?
And about that chemist and mathematician stuff. I can't marry myself, and i have advanced degrees in both. Now you've completely confused me!
The Professor
Printer Friendly | Permalink |  | Top
 
mzteris Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 09:54 AM
Response to Reply #30
31. You got the first part
Fe - - - now think "numbers" ...

:)

hehehe

Marry yourself? Reminds me of that old James Brown song - Super Bad

"I love, I love to do my thing,
ha.. and I, and I don't need, no one else
Sometimes I feels so nice, good god
I jump back, I wanna kiss myself
I've got soul, huh, and I'm super
Hey I said I'm super bad"
Printer Friendly | Permalink |  | Top
 
DelawareValleyDem Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 10:11 AM
Response to Reply #31
32. Felix
Printer Friendly | Permalink |  | Top
 
mzteris Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 10:21 AM
Response to Reply #32
33. Yup. . .
My 12yo told me that joke.

:rofl:
Printer Friendly | Permalink |  | Top
 
ProfessorGAC Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 02:09 PM
Response to Reply #31
45. Sorry, I Got Back Too Late! Somebody Beat Me To It!
Edited on Thu Feb-16-06 02:09 PM by ProfessorGAC
Besides, i'm still confused over the whole chemist and math thing.

On Edit: Mathematicians don't do Roman Numerals! I figured it out, but i hated it!
The Professor
Printer Friendly | Permalink |  | Top
 
mzteris Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 08:14 PM
Response to Reply #45
62. LOL
OK - a chemist and an historian get married . . .

:rofl:
Printer Friendly | Permalink |  | Top
 
miss_american_pie Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 09:31 AM
Response to Original message
29. Maybe if you translate that into English?
Should we post swimsuit pictures for you? ;)
Printer Friendly | Permalink |  | Top
 
ZombieNixon Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 11:11 AM
Response to Reply #29
34. ANIMATION NO WORKEY!!!!
Swimsit pics would be much appreciated. :cry:
Printer Friendly | Permalink |  | Top
 
miss_american_pie Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 01:19 PM
Response to Reply #34
42. For you


Printer Friendly | Permalink |  | Top
 
entanglement Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 11:31 AM
Response to Original message
36. I strongly recommend you study quaternions, by far the most
elegant way to represent rotations
Printer Friendly | Permalink |  | Top
 
ZombieNixon Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 11:35 AM
Response to Reply #36
37. OK, I've considered that, but I still can't wrap my head around them...
could you give me a quick rundown of what quaternions are or post a link to a site that does so?
Printer Friendly | Permalink |  | Top
 
entanglement Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 12:22 PM
Response to Reply #37
38. Sure
Here's a brief introduction:

http://mathworld.wolfram.com/Quaternion.html

Equation 29 on that page deals with representing rotations using quaternions

The mathworld site also has a fine list of references and links at the bottom

hope that helps
entanglement
Printer Friendly | Permalink |  | Top
 
ZombieNixon Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 12:28 PM
Response to Reply #38
39. Thanks a bunch
I haven't got time to look at it now, but I'll peruse it this evening and see if I can make any sense of it. :hi:
Printer Friendly | Permalink |  | Top
 
foo_bar Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 03:36 PM
Response to Reply #39
47. quickdraw quaternions (per Google)
void ZeroHysteresisRotation( TQ3Vector3D v1, TQ3Vector3D v2 )
{
TQ3Vector3D cross;
TQ3Matrix4x4 theMatrix;
TQ3Point3D orig = { 0.,0.,0. };
float dot,angle;

dot = Q3Vector3D_Dot( &v1, &v2 );

if (dot == 1.0) return; // nothing to do

Q3Vector3D_Cross( &v1, &v2, &cross ); // axis of rotation
Q3Vector3D_Normalize( &cross,&cross );

angle = 2.*acos( dot ); // angle of rotation

// set up a rotation around our chosen axis...
Q3Matrix4x4_SetRotateAboutAxis(&theMatrix, &orig, &cross, angle);
Q3Matrix4x4_Multiply( &gDocument.fRotation, &theMatrix, &gDocument.fRotation); // multiply
DocumentDraw( &gDocument ) ; // draw
}

http://www.mactech.com/articles/mactech/Vol.15/15.03/NaturalObjectRotation

I guess the trick is figuring out v1/v2. This example uses mouse I/O for the before-and-after picture, but I guess you can stick something in there just to make it spin.
Printer Friendly | Permalink |  | Top
 
ZombieNixon Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 04:23 PM
Response to Reply #47
49. What if there are three axes in play?
How do you get the angles and axes of rotation then? :shrug:
Printer Friendly | Permalink |  | Top
 
foo_bar Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 04:43 PM
Response to Reply #49
50. three axes of rotation?
Like a planet with three magnetic poles? I don't quite grok the connection to skeletal animation, aren't ragdolls all about knees, hips, elbows, maybe a neck if you're lucky? Shouldn't each bone be rotated in relation to the bone before it, as in "the hip bone's connected to the thigh bone, the thigh bone's connected to the leg bone..."?
Printer Friendly | Permalink |  | Top
 
ZombieNixon Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 04:47 PM
Response to Reply #50
51. Technically, yes.
And in creating natural motion, there are limitations on what bones can do what rotation, except since I need their rotation to be relative to ther parent bone, the skeletal structre ultimately diverges from the base bone (in my case, the pelvis), which needs to be able to rotate around x, y and z, potentially simutaneously.
Printer Friendly | Permalink |  | Top
 
Left Is Write Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 01:20 PM
Response to Original message
43. Sympathy.
Math sucks.

I'm right-brained.

Printer Friendly | Permalink |  | Top
 
ZombieNixon Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 01:22 PM
Response to Reply #43
44. I scored 50/50 on my l/r brained test...
the best (and worst) of both worlds. :grr:
Printer Friendly | Permalink |  | Top
 
meegbear Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 04:59 PM
Response to Original message
52. and then you die.
Printer Friendly | Permalink |  | Top
 
applegrove Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 05:26 PM
Response to Original message
53. That is one topic I could never get around. Darn if you don't have
computers to do it - that seems unfair.
Printer Friendly | Permalink |  | Top
 
ZombieNixon Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 07:01 PM
Response to Reply #53
57. That's the thing. I'm trying to get the computer to do it.
But the programmer/designer (me) has to know the math before he can tell the computer how to do it.
Computers are obedient, but not smart. :grr:
Printer Friendly | Permalink |  | Top
 
TheBaldyMan Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 06:38 PM
Response to Original message
55. do you want to do a simple single rotation
Edited on Thu Feb-16-06 06:40 PM by TheBaldyMan
or do you want to fling it around some?

your best bet is to use a matrix that represents a single rotation then feed in all the defining points of your object(e.g. the co-ordinates of the vertices)

if possible you might be able to combine two or more rotations by multiplying the matrix for each rotation in the order that they take place.

zA->z' ,where z is the vector <x,y,z> and A is the matrix of a simple rotation of in 3D space

think of a rotation about an axis as a vector itself, i.e. a rotation about the z-axis as a rotation about a <0,0,1> vector a rotation about the y-axis as a rotation about a <0,1,0> vector and finally the x-axis rotation as a rotation about a <1,0,0> vector, in fact you can represent any rotation with a unit vector (a unit vector is a vector with a length of 1 unit)

I don't want to take away the fun of working this out but it should prove fruitful.

on edit: I use this sort of stuff for warping/deforming graphics (only 2D but the principles are exactly the same)
Printer Friendly | Permalink |  | Top
 
ZombieNixon Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 07:06 PM
Response to Reply #55
58. That's exactly the problem.
In the API's math, a rotation of the x-axis rotates the y- and z-axes, then rotating the y-axis rotates the z-axis but not the x-axis and rotating the z-axis doesn't affect the other two.

So:
Rotate around x 90°, then around y 90°, voila! The computer thinks that your x-axis and your z-axis are the same vector. :banghead:
Printer Friendly | Permalink |  | Top
 
TheBaldyMan Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 07:49 PM
Response to Reply #58
60. that shouldn't happen ...
Edited on Thu Feb-16-06 08:03 PM by TheBaldyMan
first 90° rotation about the x-axis:
x=<1,0,0> -> <1,0,0>=x'
y=<0,1,0> -> <0,0,-1>=y'
z=<0,0,1> -> <0,1,0>=z'

second 90° rotation about the y-axis:
x'=<1,0,0> -> <0,0,-1>=x''
y'=<0,0,-1> -> <-1,0,0>=y''
z'=<0,1,0> -> <0,-1,0>=z''

x-axis is NEGATIVE z-axis
y-axis is NEGATIVE x-axis
z-axis is NEGATIVE y-axis

I worked this out on my fingers so I could be wrong!

on edit: I'm wrong
x -> z
z -> y
y -> x

on further edit: I think it's a rotation about a <1,1,1> vector of 120°
Printer Friendly | Permalink |  | Top
 
ZombieNixon Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 10:22 PM
Response to Reply #60
64. It's called gimbal lock and it's only a result of the need of the API
to rotate on axis at a time. As you showed in the last part of your post, it can be one rotation around an arbitrary axis, so I need a general equation for the axis and the angle.
Printer Friendly | Permalink |  | Top
 
TheBaldyMan Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 10:41 PM
Response to Reply #64
65. try a rotation of 120° using a (1,1,1) vector as an axis of rotation
Edited on Thu Feb-16-06 10:42 PM by TheBaldyMan
it's equivalent to what you describe. That is if your package supports rotation around a given vector. If it needs a unit vector the co-ords are < 1/√3 , 1/√3 , 1/√3 >
Printer Friendly | Permalink |  | Top
 
ZombieNixon Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 10:57 PM
Response to Reply #65
66. It'll do it, but what I need is a general equation.
I need <theta,phi,rho> to be converted in to theta degrees about arbitrary axis <x,y,z> depending on what the values are for theta, phi and rho.

120° over <1,1,1> is only equivalent to <90°,90°,90°>. What if those values were different?
Printer Friendly | Permalink |  | Top
 
TheBaldyMan Donating Member (1000+ posts) Send PM | Profile | Ignore Fri Feb-17-06 12:34 AM
Response to Reply #66
70. here goes nothing ...
Edited on Fri Feb-17-06 12:39 AM by TheBaldyMan
a rotation of angle A around a vector V=(x,y,z) is given by the following matrix M and is as follows (it's supposed to be a 3x3 matrix)

( cosA.cosB+sinA.sinB , cosA.sinB+sinA.sinB , 0 )
(-sinA.cosB-cosA.sinB ,-sinA.sinB+cosA.cosB , 0 ) .cosC
( 0 , 0 , 1 )

where C=arcsin(z/√ (x²+y²+z²)) ; B = arcsin (y/z)

I think this is right but I'll have to check it at the library to be sure.

The cosC is scalar multiplication across all the terms of the matrix.

If you want I could bore the tits of you with a proof.
Printer Friendly | Permalink |  | Top
 
TheBaldyMan Donating Member (1000+ posts) Send PM | Profile | Ignore Fri Feb-17-06 03:15 AM
Response to Reply #70
71. here's a .pdf file that might make it clearer
Edited on Fri Feb-17-06 03:23 AM by TheBaldyMan
a nicer laid out formula
please let me know if it is of any use

on edit: there is an error in the formula for the angle psi, it should read "psi=arctan(b/a)"
Printer Friendly | Permalink |  | Top
 
ZombieNixon Donating Member (1000+ posts) Send PM | Profile | Ignore Fri Feb-17-06 03:17 AM
Response to Reply #71
72. I get a "file doesn't exist" error.
:shrug:
Printer Friendly | Permalink |  | Top
 
TheBaldyMan Donating Member (1000+ posts) Send PM | Profile | Ignore Fri Feb-17-06 03:25 AM
Response to Reply #72
74. i load it ok, try again?
Printer Friendly | Permalink |  | Top
 
ZombieNixon Donating Member (1000+ posts) Send PM | Profile | Ignore Fri Feb-17-06 01:47 PM
Response to Reply #74
75. Got it, thanks!
:thumbsup:
Printer Friendly | Permalink |  | Top
 
TheBaldyMan Donating Member (1000+ posts) Send PM | Profile | Ignore Fri Feb-17-06 03:24 AM
Response to Reply #71
73. dupe
Edited on Fri Feb-17-06 03:25 AM by TheBaldyMan
Printer Friendly | Permalink |  | Top
 
GoddessOfGuinness Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 06:44 PM
Response to Original message
56. I'm mathematically dyslexic
I don't know if it sucks or not. All I know is I suck at it. :toast:
Printer Friendly | Permalink |  | Top
 
ZombieNixon Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 07:07 PM
Response to Reply #56
59. This is a six: 6. 5+1 = 6. This ia a nine: 9. 8+1 = 9.
:P
Printer Friendly | Permalink |  | Top
 
GoddessOfGuinness Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 08:08 PM
Response to Reply #59
61. 6+9=
thread locked. ;-)
Printer Friendly | Permalink |  | Top
 
Burried News Donating Member (1000+ posts) Send PM | Profile | Ignore Thu Feb-16-06 08:21 PM
Response to Reply #59
63. Good site for quaternions
This author (Sweetser at website below) sees a quaternion as an ordered pair (aB) where a is a scalor and B is a 3 component vector.
Multiplying two of them (aB)x(cD) follows the same algebra as (a+b)x(c+d) except that vectors need a dot product and cross product possibility. This guys approach lets you do these things almost in your head rather than do matrix multiplication.

See this page for his multiplication rule.
http://www.theworld.com/~sweetser/quaternions/intro/multiplying/multiplying.html
See this page for whole article
http://world.std.com/~sweetser/quaternions/qindex/qindex.html

He links to a quaternion Calculator which might be of help to you.
http://www.theworld.com/~sweetser/java/qcalc/qcalc.html

I am not in your field but basically you are using your computer to find Euler's angles. I suspect that part of your problem is that the multiplications you are dealing with are not communtative, which means that AB does NOT equal BA (it equals -BA). See link below for relationship between Euler angles and Quaternions.
http://www.mathworks.com/access/helpdesk/help/toolbox/aeroblks/quaternionstoeulerangles.html

My way of looking at rotations and quaternions is:
Multiplying by a complex number causes a rotation in a plane. Since the real world has three planes you need three complex numbers - not just 'i' but 'j' and 'k' as well. A quaternion is a three dimensional complex number. To do TWO 3 dimentional rotations means you must multiple your object by two Quaternions (or multiply the Quats first and then multiply your object by the result.

Hope this helps.
One caution, different authors define a positive Euler angle differently (think of it like electric current - some define it as going from negative to positive others as positive to negative.)

Finally a good book for rotation and complex multiplication.
Needham, Complex Analysis a Visual Approach.

Printer Friendly | Permalink |  | Top
 
Innocent Smith Donating Member (466 posts) Send PM | Profile | Ignore Fri Feb-17-06 10:20 PM
Response to Original message
76. Quaternions are your friend
The square root of negative one can sometimes be very useful.
Printer Friendly | Permalink |  | Top
 
DU AdBot (1000+ posts) Click to send private message to this author Click to view 
this author's profile Click to add 
this author to your buddy list Click to add 
this author to your Ignore list Fri Apr 26th 2024, 01:47 AM
Response to Original message
Advertisements [?]
 Top

Home » Discuss » The DU Lounge Donate to DU

Powered by DCForum+ Version 1.1 Copyright 1997-2002 DCScripts.com
Software has been extensively modified by the DU administrators


Important Notices: By participating on this discussion board, visitors agree to abide by the rules outlined on our Rules page. Messages posted on the Democratic Underground Discussion Forums are the opinions of the individuals who post them, and do not necessarily represent the opinions of Democratic Underground, LLC.

Home  |  Discussion Forums  |  Journals |  Store  |  Donate

About DU  |  Contact Us  |  Privacy Policy

Got a message for Democratic Underground? Click here to send us a message.

© 2001 - 2011 Democratic Underground, LLC