CGAL: rotate Nef Polyhedron

67 Views Asked by At

CGAL gives an example of how to rotate a Nef_polyhedron 90 degrees around the x-axis (https://doc.cgal.org/latest/Nef_3/Nef_3_2transformation_8cpp-example.html). I am not exactly sure what the parameters that are being passed in the rotx90 variable mean and I can't find any extra information about them. Can someone elaborate on them?

  Aff_transformation_3 rotx90(1,0,0,
                              0,0,-1,
                              0,1,0,
                              1);,
  N.transform(rotx90);

My goal is to create a function that takes in three arguments: degreesX, degreesY, and degreesZ, and converts these three arguments into the nessesary parameters for the rotx90 variable.

1

There are 1 best solutions below

0
On BEST ANSWER

These parameter stand for the nine entries in an elemental rotational matrix, the tenth is its power, i.e. how many times we apply the matrix.

It reads: The new x-coordinate is a linear combination of 1 times the old x-coordinate, 0 times the old y-coordinate, and 0 times the old z-coordinate, so $(1,0,0...$ Similarly, the new y-coordinate is a linear combination of $(0,0,-1$ times the old z-coordinate$)$, and the last triple $(0,1,0)$ then assigns old y to new z.

The rotation about one of the axes of a coordinate system is called a basic or elemental rotation. The following three basic rotation matrices rotate vectors by an angle θ about the x-, y-, or z-axis, in three dimensions, using the right-hand rule, which codifies their alternating signs. $R_x(\theta)$ is what you are looking for.

\begin{alignedat}{1}R_{x}(\theta )&={\begin{bmatrix}1&0&0\\0&\cos \theta &-\sin \theta \\[3pt]0&\sin \theta &\cos \theta \\[3pt]\end{bmatrix}}\\[6pt]R_{y}(\theta )&={\begin{bmatrix}\cos \theta &0&\sin \theta \\[3pt]0&1&0\\[3pt]-\sin \theta &0&\cos \theta \\\end{bmatrix}}\\[6pt]R_{z}(\theta )&={\begin{bmatrix}\cos \theta &-\sin \theta &0\\[3pt]\sin \theta &\cos \theta &0\\[3pt]0&0&1\\\end{bmatrix}}\end{alignedat}