Thread: OpenGL Object Rotation

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Don't use Euler angles for orientation. You can use axis-angle or Quaternion representations.
    Collision detection is done through AABB's, OOBB's and finally ray triangle intersections. Whether you do these in world or local space is totally up to you.

    The order of transforms is:

    W = I S R O T
    where O is T(center) * R(orbit)
    I is identity or can be the parent's world matrix.

  2. #2
    Bored Programmer
    Join Date
    Jul 2009
    Location
    Tomball, TX
    Posts
    428
    Thanks for the response bubba. I was using AABB then when I got into rotations I realized they wouldn't be accurate so I figured out how to do Point to Triangles which has been my current method(though the abrreviates you gave me show I've been overcomplicating it). I never heard of OOBB before, but I just read up on it sounds pretty simple.

    Quaternions on the other hand not sinking in so well. Just bought a calculus book though (never took the class in high school), so hopefully a few days should shed some light on it. What I found kind of strange though.

    Quaternions don't suffer from gimbal lock, unlike Euler angles.
    then
    You have to convert them to get a human-readable representation (Euler angles) or something OpenGL can understand (Matrix).
    How is this logic not circular? Having to convert back to Euler in order to use them in OpenGL doesn't still give you the possibility of suffering from gimbal lock?
    Virtual reality hello world http://www.rodneybrothers.com/vr/vrh...rld/index.html in html and javascript.
    Viewable with dodocase, google cardboard, OR, and other compatible VR gear.

  3. #3
    Bored Programmer
    Join Date
    Jul 2009
    Location
    Tomball, TX
    Posts
    428
    On further review of my calculus book and Wiki it appears a Quaternion is a set of 4 numbers (much like a triple or cartesian coordinates) that has another scaler (real number) added to it. or
    Code:
    Quaternion = W + Xi + Yj + Zk; (don't understand why wiki said that)
    Seems by discription this is an ordered quad and not a formula to derive one number. (correct me if I'm wrong)
    It would make more sense to me as.
    Code:
    Quaternion = {w, xi, yj, zk};
    W being the 4th point in space. I, J, and K were throwing me off I couldn't find anything about it. Then chapter 11 (Vectors, Points, and Planes) got into a section on Unit Vectors.
    Unit Vector - A vector whose length is equal to 1.
    Code:
    Length = sqrt((x*x) + (y*y) + (z*z))
    It defined i, j, and k in the book as defualt unit vectors i.e. vectors that equal 1 in length on their respective plane.
    Code:
    X unit vector    i = (1, 0, 0)
    Y unit vector    j = (0, 1, 0)
    Z unit vector   k = (0, 0, 1)
    Am I correct in assuming that these are refering to the same thing? Then my guess would be that i, j, and k are unit vectors drawn to represent the angle of rotation of an object, but I don't get how to find 180 degrees of rotation on any given axis with i, j, and k, since they are represented as a length of 1 and therefore can only be denoted.
    i || -i ,
    j || -j,
    k || -k

    Web links I've used thus far.
    OpenGL:Tutorials:Using Quaternions to represent rotation - GPWiki
    Quaternion - Wikipedia, the free encyclopedia

    I know the first one has the functions drawn explicitly, but I don't understand the basic math so I'm not going to copy and paste it.
    Virtual reality hello world http://www.rodneybrothers.com/vr/vrh...rld/index.html in html and javascript.
    Viewable with dodocase, google cardboard, OR, and other compatible VR gear.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Favourite program
    By progcomputeach in forum General Discussions
    Replies: 18
    Last Post: 08-04-2010, 05:27 AM
  2. Memory Leak in AppWizard-Generated Code
    By jrohde in forum Windows Programming
    Replies: 4
    Last Post: 05-19-2010, 04:24 PM
  3. OpenGL Shadow Mapping Issues
    By animeaholic in forum Game Programming
    Replies: 0
    Last Post: 06-05-2007, 09:49 AM
  4. rotation in OpenGL
    By linuxdude in forum Game Programming
    Replies: 4
    Last Post: 08-09-2006, 11:29 PM
  5. Clicking an Object in OpenGL.
    By gpr1me in forum Game Programming
    Replies: 5
    Last Post: 03-26-2006, 10:12 PM