+ Reply to Thread
Results 1 to 7 of 7
Like Tree6Likes
  • 1 Post By Galuhad
  • 1 Post By Imhothar
  • 1 Post By Galuhad
  • 1 Post By Olandria
  • 1 Post By Galuhad
  • 1 Post By Olandria

Thread: Roll, Pitch, and Yaw(n)

  1. #1
    Rift Disciple Galuhad's Avatar
    Join Date
    Feb 2011
    Location
    London, UK
    Posts
    130

    Default Roll, Pitch, and Yaw(n)

    Hi,

    I have recently fell in love with dimension building, and have taken it on myself to rebuild the old Dimension Toolbox addon after seeing a number of requests for it. After spending the day looking into the mechanics of dimension building, I am stumbling on something that I just can't get my head around.

    I would like to improve on how rotations are calculated. A very straight-forward example, lets say I place a new item in my dimension. By default it will face forward with yaw:0, pitch:0, and roll:0. Now if I want to rotate the item along the yaw by 45 degrees, it becomes yaw:45, pitch:0, and roll:0. Seems easy enough to just load the items yaw, increase it by 45 (well actually, the radian equivalent), and place the item with the new yaw. This works, pretty well, so long as the yaw does not go beyond 90 degrees. When it does, as will be many cases, the simple calculation can no longer be used.

    The yaw seems to follow a sine wave, if we imagine the green yaw circle which contains 360 degrees, instead of the yaw value increasing from 0 to 360 as it rotates, it instead ranges from -90 to +90 (0, 45, 90, 45, 0, -45, -90, -45, 0) - where 180 degrees is actually 0. When you reach the first 90 degree point where the value starts to decrease again, the dimension item does an interesting thing and flips 180 degrees on both the pitch and roll planes
    So the point where the yaw should read 91, actually equals yaw:89, pitch:-180, roll:-180.
    This makes it extremely challenging to allow for +45 degree increments on the yaw plane. When the item is flat and the pitch and roll remain constant at -180 then the calculation can be achieved. but when the item is flipped on it's side as can happen, it would appear that the new calculation for the yaw is dependent on the values of roll and pitch.

    Why is this useful? It is very rare that we build on exact 90 degree angles to follow the x,y,z planes. If the dimension is built at say a 30 degree angle, then I would want to be able to easily specify that in the addon for each new item placed - making it easier for everything to align with the angle I have chosen for my constructions (but without any weirdness currently experienced by simply adding the yaw values).

    Ultimately I am looking to create a function that does something like this:

    Code:
    function ApplyRotation(someItemID) -- Starting values local curYaw = Inspect.Dimension.Layout.Detail(someItemID).yaw; local curPitch = Inspect.Dimension.Layout.Detail(someItemID).pitch; local curRoll = Inspect.Dimension.Layout.Detail(someItemID).roll; -- Rotations to be applied local yawRotation = 45; local pitchRotation = 0; local rollRotation = 0; -- Calculations local newYaw = < do funny calculation here >; local newPitch = < do funny calculation here >; local newRoll = < do funny calculation here >; -- Apply rotation to item Command.Dimension.Layout.Place(SomeItemID, {["yaw"]=newYaw;["roll"]=newRoll;["pitch"]=newPitch})
    end
    I have looked a lot at Euler rotations and there's a lot of posts about vectors and funny greek letters that really means nothing to me. I am not a programmer by trade, or a mathematician. But if anyone who perhaps is could shed some light for me, I would really appreciate it.

    Thank you.
    GALUHAD
    CSTM - Faeblight (RP - NA)
    Dimensions: Elven Retreat | Floods of Isengard (PvP)
    Twitter | Twitch | YouTube

  2. #2
    Plane Walker Imhothar's Avatar
    Join Date
    Feb 2012
    Posts
    439

    Default

    Euler angles are a pain to work with. They suffer from Gimbal Lock and other nuisances, do not represent rotations uniquely and the order of application matters. That's why they are usually avoided inside proper transformation code. The rotations 91/0/0 and 89/-180/-180 are equivalent.

    You won't be able to avoid getting your hands dirty with some math stuff. Either rotation matrices or quaternions for doing the actual rotations and then convert them to yaw/pitch/roll for the API. Don't do the math directly with the Euler angles.

    It looks like the game is using quaternions internally and the values you get are computed from them. This also means you can get any combination of values as long as they represent the same rotation.
    Author of the Imhothar's Bags addon.

  3. #3
    Rift Disciple Galuhad's Avatar
    Join Date
    Feb 2011
    Location
    London, UK
    Posts
    130

    Default

    Quote Originally Posted by Imhothar View Post
    Euler angles are a pain to work with. They suffer from Gimbal Lock and other nuisances, do not represent rotations uniquely and the order of application matters. That's why they are usually avoided inside proper transformation code. The rotations 91/0/0 and 89/-180/-180 are equivalent.

    You won't be able to avoid getting your hands dirty with some math stuff. Either rotation matrices or quaternions for doing the actual rotations and then convert them to yaw/pitch/roll for the API. Don't do the math directly with the Euler angles.

    It looks like the game is using quaternions internally and the values you get are computed from them. This also means you can get any combination of values as long as they represent the same rotation.

    Thanks for the response. I don't mind getting my hands dirty, but I need someone who really understands this to help me out, please.
    GALUHAD
    CSTM - Faeblight (RP - NA)
    Dimensions: Elven Retreat | Floods of Isengard (PvP)
    Twitter | Twitch | YouTube

  4. #4
    Shadowlander Olandria's Avatar
    Join Date
    Jul 2011
    Posts
    34

    Default

    I have a degree in computational physics that you might come in handy!

    EDIT: Let me add on that..

    I've previously worked on stuff such as physics engines and simple graphics, where the mathematics of object collision detection and angles are fundamental and need to be covered in detail. So perhaps I could help you out mate
    Last edited by Olandria; 07-20-2013 at 10:31 AM.

  5. #5
    Rift Disciple Galuhad's Avatar
    Join Date
    Feb 2011
    Location
    London, UK
    Posts
    130

    Default

    Quote Originally Posted by Olandria View Post
    I have a degree in computational physics that you might come in handy!

    EDIT: Let me add on that..

    I've previously worked on stuff such as physics engines and simple graphics, where the mathematics of object collision detection and angles are fundamental and need to be covered in detail. So perhaps I could help you out mate
    That would be fantastic! If you could I would really appreciate it.
    GALUHAD
    CSTM - Faeblight (RP - NA)
    Dimensions: Elven Retreat | Floods of Isengard (PvP)
    Twitter | Twitch | YouTube

  6. #6
    Shadowlander Olandria's Avatar
    Join Date
    Jul 2011
    Posts
    34

    Default

    Of course man, I love this kind of stuff! As far as I know, what you are describing is known in physics as "Givens rotations" and the formalism around it. I have been working with it earlier, so it's just a matter of translating the code I have to Lua and it should work just fine.

    However, I will need to know exactly what kind of functionality you are looking for, and I am not familiar with the Rift API regarding dimension translation and rotation, so perhaps we could continue this in PM or voicecomm?

    EDIT: Givens rotation in 3D that is.
    Last edited by Olandria; 07-20-2013 at 03:22 PM.
    "To those who do not know mathematics it is difficult to get across a real feeling as to the beauty, the deepest beauty, of nature."
    ― Richard P. Feynman

  7. #7
    Rift Disciple FreakyFreak's Avatar
    Join Date
    Mar 2011
    Posts
    181

    Default

    I wish i could help. All i got is this...
    I love you guys. That is all.
    Dims on Greybriar: izydoesit- Fus Ro Dah / freakyfreak- River Gods / amorica- Izy n Sons
    Ideas worth trying. *Please take them and make them even better.*

+ Reply to Thread

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