Results 1 to 7 of 7

Thread: Some geometric problems :P

  1. #1

    Some geometric problems :P

    Ok that's the problem:
    i've my 3d car, with it's own orientation and position. I want it to reach a certain point by acting on the steer. The question is: how can i choose to steer left or right ?
    I think the basic question is, given a rotation matrix, how can i say if the object lies on the left or on the right ?

    Please help
    If you save your data in a proprietary format, the owner of the format owns your data.
    <br /><A href="http://msx80.blogspot.com">http://msx80.blogspot.com</A>

  2. #2

    Some geometric problems :P

    To see if it?¢_Ts on the left or right you need to transform you?¢_Tre destination point so it?¢_~s coordinate system is the same as you?¢_Tre cars and check if it?¢_Ts X component is positive or not. To do the transformation you need to multiply that point by a translation matrix to move it?¢_Ts zero point to the cars position then by inverse or you?¢_Tre cars rotation matrix.

  3. #3

    Some geometric problems :P

    Quote Originally Posted by Paulius
    To see if it?¢_Ts on the left or right you need to transform you?¢_Tre destination point so it?¢_~s coordinate system is the same as you?¢_Tre cars and check if it?¢_Ts X component is positive or not. To do the transformation you need to multiply that point by a translation matrix to move it?¢_Ts zero point to the cars position then by inverse or you?¢_Tre cars rotation matrix.
    Ehm ok.. let's take a step at a time! :mrgreen:

    I've the vector "position" of the car, the matrix "rotation" of the car and the "target" vector for where i want to drive to.

    First, i obtain the 4x4 matrix that translate the origin to the car for both position and orientation, right ?

    Then, i multiply the "target" by that matrix, and i get the "target" transformed to the new origin (the car). How do i do this multiplication?

    Now, i check the X axis (that's easy.. )

    Ok, i think i've understood the method.. now the problem is implementing it

    Thank!

    PS Paulius, maybe do you have a nice matrix calculation unit ?

    PPS Anyone knows if the ODE matrices are compatible to the OpenGL ones ? Are they arranged in the same way in memory ?
    If you save your data in a proprietary format, the owner of the format owns your data.
    <br /><A href="http://msx80.blogspot.com">http://msx80.blogspot.com</A>

  4. #4

    Some geometric problems :P

    First you need to make target?¢_Ts coordinate relative to the cars position (you could just subtract "position" from "target" for that), then you want to rotate the "target" by the opposite of you?¢_Tre car?¢_Ts rotation (to acieve that you have to multiply "target" vector by an opposite (transpose) of you?¢_Tre cars rotation matrix). You can try to build the rotation matrix from whatever you use to describe orientation, but as that matrix is useful in other places like collision detection you might as well use it to describe object orientation. I use Mike Lischke?¢_Ts geometry unit for matrix operations http://www.soft-gems.net/Graphics.php#Geometry

  5. #5

    Some geometric problems :P

    Quote Originally Posted by Paulius
    First you need to make target?¢_Ts coordinate relative to the cars position (you could just subtract "position" from "target" for that), then you want to rotate the "target" by the opposite of you?¢_Tre car?¢_Ts rotation (to acieve that you have to multiply "target" vector by an opposite (transpose) of you?¢_Tre cars rotation matrix). You can try to build the rotation matrix from whatever you use to describe orientation, but as that matrix is useful in other places like collision detection you might as well use it to describe object orientation. I use Mike Lischke?¢_Ts geometry unit for matrix operations http://www.soft-gems.net/Graphics.php#Geometry
    Ok, now it's clearer.. Thanks
    One thing i didn't understood: why have i to use the inverse of the matrix instead of the matrix itself ?
    What do i get if I use the non-inversed matrix ?
    If you save your data in a proprietary format, the owner of the format owns your data.
    <br /><A href="http://msx80.blogspot.com">http://msx80.blogspot.com</A>

  6. #6

    Some geometric problems :P

    I used a wrong term, it's supposed to be not inverse but transpose. Why use an opposite rotation? Look at some point in front of you, if you turn youre head to the right and think youre head is the origin of the axis, then that point has relativelly rotated to the left (the opposite).

  7. #7

    Some geometric problems :P

    Quote Originally Posted by Paulius
    I used a wrong term, it's supposed to be not inverse but transpose. Why use an opposite rotation? Look at some point in front of you, if you turn youre head to the right and think youre head is the origin of the axis, then that point has relativelly rotated to the left (the opposite).
    :mrgreen: :mrgreen: :mrgreen: :mrgreen:
    It works! I'm too happy
    I confess that i thought i was going nowhere with this matrices.. Instead i just corrected the transpose and it worked
    Now i've a nice car that follow the player wherever he goes

    I've finally undestood how this obscure matrices work.

    Thanks for your help Paulius
    If you save your data in a proprietary format, the owner of the format owns your data.
    <br /><A href="http://msx80.blogspot.com">http://msx80.blogspot.com</A>

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •