quaternion

How to determine which side of a 3D plane is showing?

This is a 3d n00b question. I'm working on a WPF control which implements the basics of Silverlight's PerspectiveTransform feature, allowing a 2D plane to be rotated on any of the three axes. It works pretty well. However I'm a little stuck on the math required to determine whether or not the back of the plane is showing. My naive code ...

C++ / openGL: Rotating a QUAD toward a point using quaternions (updated)

When I have a QUAD at a certain position, how can I rotate it in such a way that its normal points toward a given point? Imagine the colored blocks are just rectangular quads, then this image shows a bit what I mean. The quads are all oriented in such a way they point toward the center of the sphere. Maybe this second image shows a bi...

Limit camera pitch

How can I efficiently limit camera pitch when I have only camera quaternion? Do I have to convert to euler angles and then back to quaternion or is there any other way? ...

the logarithm of quaternion

i'm reading <<3D math primer for graphics and game development>> By Fletcher Dunn and Ian Parberry, on page 170, the logarithm of quaternion is defined as log q = log([cosa nsina]) ≡ [0 an] i don't see how does log([cosa nsina]) equals to [0 an], can anyone help me out? thanks. ...

Quaternion and three axes

Given a quaternion q, and three 3D vectors (vx, vy, vz) which form coordinate axes, which can be oriented in arbitrary direction, but are all perpendicular to each other, thus forming a 3d space. How can I check if the quaternion q is rotated to the same direction (or opposite direction) as some of the 3D vectors (vx, vy, vz)? ...

Object quaternion parallel or perpendicular to all basis vectors

Given an object quaternion q, and basis vectors vx, vy, vz forming a 3D space, how can I check whether the quaternion is parallel or perpendicular to all of the basis vectors? For example, I have basis vectors: vx = (0.447410, 0, -0.894329) vy = (0, 1, 0) vz = (0.894329, 0, 0.447410) and quaternion q(w,x,y,z) = (-0.973224, 0, -0.22986...

Quaternion Camera with DirectX

Hi! I would like to write quaternion camera. But unfortunatelly it gets "NULLED". I don't know where I was wrong. I have 3 additional quaternion for easy moving (up, look, thirdA) The bad code: void _camera::rotateX(float angle) { thirdA.w = angle; D3DXQUATERNION tmp; D3DXQUATERNION tmp2; D3DXQuaternionConjugate(&tmp, &...

Arcball Rotation at 90 degrees

Hi, I have successfully implemented Arcball rotation through quaternions, but am confused at what to do when the direction vector of the camera is parallel to up vector. Currently I am just restricting the rotation along the x-axis (the pitch) when the dot product of the direction vector and the up vector exceeds 0.99. In Maya (or Max, ...

Compare Quaternion to axis

I have the orientation of an object stored as a unit quaternion, and I want to see what angle the object's local x axis makes with the global y axis. What's the easiest way to do that? Thanks! ...

Component of a quaternion rotation around an axis

I'm having trouble finding any good information on this topic. Basically I want to find the component of a quaternion rotation, that is around a given axis (not necessarily X, Y or Z - any arbitrary unit vector). Sort of like projecting a quaternion onto a vector. So if I was to ask for the rotation around some axis perpendicular to the ...

How do you set an objects Orientation to another objects in Ogre3D?

I tried do do this: Ogre::Vector3 src = bone1->_getDerivedOrientation() * Ogre::Vector3::UNIT_X; Ogre::Quaternion quatt = src.getRotationTo(bone2->_getDerivedOrientation() * Ogre::Vector3::UNIT_X); bone1->rotate(quatt); src = bone1->_getDerivedOrientation() * Ogre::Vector3::UNIT_Y; quatt = src.getRotationTo(bone2->_getDerivedO...

Translating a Quaternion

(perhaps this is better for a math Stack Exchange?) I have a chain composed of bones. Each bone has a with a tip and tail. The following code computes where its tip will be, given a rotation, and sets the next link in the chain's position appropriately: // Quaternion is a hand-rolled class that works correctly (as far as I can tell...

What's a quaternion rotation?

Is quaternion rotation just a vector with X,Y,Z which the object will rotate towards, and a roll which turns the object on its axis? Is it that simple? Meaning if you have X=0, Z=0 and Y=1 the object will face upwards? And if you have Y=0, Z=0 and X=1 the object will face to the right? (assuming X right, Y up and Z depth) ...

Traveling along the surface of a sphere using quaternions

I'm programming a 3D game where the user controls a first-person camera, and movement is constrained to the inside surface of a sphere. I've managed to constrain the movement, but I'm having trouble figuring out how to manage the camera orientation using quaternions. Ideally the camera up vector should point along the normal of the spher...