R=Rofview090(ew,aw)
ew : | elevation angle as in view | |
aw : | azimut angle as in view |
R : | Matrix to rotate a solid that it look in view(0,90) like in (ew,aw); |
SGsample(17); A=ans; view(-30,30); %
R=Rofview090(-30,30); B=SGtransR(A,inv(R)); view(0,90); SGplot(B,'g');
This function, Rofview090
, is designed to compute a rotation matrix that aligns a 3D object to a specific view direction. The function is part of the SolidGeometry library and was created by Tim Lueth.
Tofview
is called with the input parameters ew
and aw
. This function likely computes a transformation matrix T
that aligns the view to the specified angles.R
is computed by taking the top-left 3x3 submatrix of T
and multiplying it by a rotation matrix rot(0, pi, 0)
. This additional rotation aligns the object to the desired view.The example provided in the comments demonstrates how to use the function:
SGsample(17);
- Generates a sample 3D object.A=ans;
- Stores the generated object in variable A
.view(-30,30);
- Sets the current view to angles -30 and 30.R=Rofview090(-30,30);
- Computes the rotation matrix R
for the specified view angles.B=SGtransR(A,inv(R));
- Applies the inverse of the rotation matrix to the object A
, resulting in object B
.view(0,90);
- Changes the view to angles 0 and 90.SGplot(B,'g');
- Plots the transformed object B
in green.