Re: dotproduct rotations

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



The angle returned is the smallest angle between the two vectors, so you'll
need an additional sign check on one of the original vector's axis to decide
whether or not to add 180 degrees to the returned angle.

--
Wessam Bahnassi
Microsoft DirectX MVP,
Software Engineer
Electronic Arts Inc.
--
In|Structurez Arabic Gamedev Community
www.instructurez.com


"Pathogen" <Jaryth_Saryth@xxxxxxxxxxx> wrote in message
news:Oe5XlEIYGHA.3704@xxxxxxxxxxxxxxxxxxxxxxx
Okay i know the dotproduct of two vectors will give me the cos(theta)
angle
between them therefor the

theta = acosf(dotproduct(vector1,vector2)

this also has several possibilities of theta that can be determined using
the cross product here is my code


//y rotation

dataContainer.vRotation.y =
D3DXVec3Dot(&D3DXVECTOR3(0.0f,0.0f,1.0f),&temporary);

ret.vRotation.y = acosf(dataContainer.vRotation.y);

D3DXVec3Cross(&crossproduct,&D3DXVECTOR3(0.0f,0.0f,1.0f),&temporary);

if( crossproduct.y < 0.0f ){

ret.vRotation.y = -(ret.vRotation.y);

}

//z rotations

dataContainer.vRotation.z =
D3DXVec3Dot(&D3DXVECTOR3(1.0f,0.0f,0.0f),&temporary);

ret.vRotation.z =
acosf(dataContainer.vRotation.z/D3DXVECTOR3(1.0f,0.0f,0.0f)*temporary);

D3DXVec3Cross(&crossproduct,&D3DXVECTOR3(1.0f,0.0f,0.0f),&temporary);

if( crossproduct.z < 0.0f ){

ret.vRotation.z = -(ret.vRotation.z);

}



now the rotations around the y axis work perfectly but the rotations
around
the z does not it will only work in one direction... Has anyone any help
on
getting these rotation methods to work in direct3d?




.



Relevant Pages

  • Re: dotproduct rotations
    ... my rotation around the y axis should be positive 45 degrees im pretty sure ... below code return me an angle 10 degrees miss aligned. ... Also if i want to find the rotation around an axis shouldnt I be considering ... Microsoft DirectX MVP, ...
    (microsoft.public.win32.programmer.directx.graphics)
  • Re: Moving object along z axis
    ... The problem is that it moves not along the z axis but diagonally ... (according to position /slope angle of the object) ... The problem also that I have a lot of transformation to do ... Translate first, then do the rotations. ...
    (comp.graphics.api.opengl)
  • Re: How to calculate the angle between two images?
    ... angle of 'twist' between a known reference image and a rotated image was accomplished very reliably even for arbitrary images. ... rotations, such as 45 degrees, where some information is rotated ...
    (comp.soft-sys.matlab)
  • Re: Rotations - why are they not vectors
    ... through an angle in 1 dimension?) ... For that it is not unreasonablke for me to expect ... What is unclear about "1-D rotations about a fixed axis"? ... specified by a 1-tuple x a linear displacement. ...
    (sci.math)
  • Quaternions for a continuous sequence of rotations?
    ... that is equivalent to a sequence of specified rotations, ... Now think of a situation where the axis and angle change ...
    (sci.math)