I have an object in 3d space that I want to align in vector. I already got Y-rotation by doing atan2 on the x and z component of the vector. but I would also like to have an X-rotation so that the object looks up or down.
imagine a plane that makes it a feed shaft, just without a roll.
I use openGL to set the turns, so I need the Y-angle and X-angle.
You must use some form of Quaternion interpolation ( Spherical Linear Interpolation ) to animate your object from its current orientation to this new orientation.
Quaternions ( ), . Slerp, .
, .
, /. , Opengl glRotate .
, , - , . (, ) , from to .
from
to
axis = from X to
from.to = cos(theta) ( )
from.to = cos(theta)
theta = arccos(from.to)
glRotate(axis, theta) from to.
glRotate(axis, theta)
, , , . , , .
... . , , , , .
Source: https://habr.com/ru/post/1733665/More articles:What is Quirks mode classified in document mode and how do I change it? - htmlКак извлечь информацию о пуле из документа Word? - interopreturn User Quota with PHP from Linux - linuxHow to style different elements differently when using data template in xaml? - .netsafariwatir: how to choose an anonymous button - ruby | fooobar.comConfiguring APC with Drupal - phpHTTP ERROR: 500 Serious SolR Configuration Errors - luceneOverride the neutral language of a specific resource file in an assembly - .netчто "возвращает $container → {$ resource};" имею в виду - phpHow to integrate StyleCop in Tfs 2010 - tfsAll Articles