Outils pour utilisateurs

Outils du site


doc:images:3d

Ceci est une ancienne révision du document !


Ici, tout le code est présenté pour la Point Cloud Library mais c'est aussi applicable pour OpenGL.

Matrice de rotation pour mettre un point sur l'axe X

Rappel : rotation autour de l'axe 0,0,0.

On commence par enlever la coordonnée Y :

float alpha = atan2(y, x);
Eigen::AngleAxisf(-alpha, Eigen::Vector3f::UnitZ())

Puis autour de l'axe Y mais la coordonnée en X a changée.

Eigen::AngleAxisf(atan2f(z, cosf(alpha)*x+sinf(alpha)*y), Eigen::Vector3f::UnitY())

<note> Si on souhaite regrouper plusieurs matrices de rotation dans une seule, il faut : $R = R_2 * R_1 $ </note>

Matrice de rotation sur la base d'un vecteur unitaire

$$R = \pmatrix{ —\mathbf u_1—\\ —\mathbf u_2—\\ —\mathbf u_3—} = \pmatrix{ {n_y\over\sqrt{n_x^2+n_y^2}} & {-n_x\over\sqrt{n_x^2+n_y^2}} & 0 \\ {n_xn_z\over\sqrt{n_x^2+n_y^2}} & {n_yn_z\over\sqrt{n_x^2+n_y^2}} & -\sqrt{n_x^2+n_y^2} \\ n_x & n_y & n_z}$$

Getting a transformation matrix from a normal vector Archive du 19/03/2019

doc/images/3d.1552992249.txt.gz · Dernière modification : 2019/03/19 11:44 de root