Rofview090

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - User interface
Introduced first in SolidGeometry 4.7, Creation date: 2019-07-01, Last change: 2025-09-14

returns the rotation matrix to rotate the object into a view direction

Description

i.e. T=Tofview(ew,aw); R=(T(1:3,1:3) *rot(0,pi,0));


See Also: Tofcam , Tofview

Example Illustration

 missing image of Rofview090(ew,aw)

Syntax

R=Rofview090(ew,aw)

Input Parameter

ew: elevation angle as in view
aw: azimut angle as in view

Output Parameter

R: Matrix to rotate a solid that it look in view(0,90) like in (ew,aw);

Examples


SGsample(17); A=ans; view(-30,30); %
R=Rofview090(-30,30); B=SGtransR(A,inv(R)); view(0,90); SGplot(B,'g');




Copyright 2019-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth

Algorithm (Workflow)

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.

Input Parameters

Output

Algorithm Steps

  1. The function 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.
  2. The rotation matrix 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.

Example Usage

The example provided in the comments demonstrates how to use the function:

  1. SGsample(17); - Generates a sample 3D object.
  2. A=ans; - Stores the generated object in variable A.
  3. view(-30,30); - Sets the current view to angles -30 and 30.
  4. R=Rofview090(-30,30); - Computes the rotation matrix R for the specified view angles.
  5. B=SGtransR(A,inv(R)); - Applies the inverse of the rotation matrix to the object A, resulting in object B.
  6. view(0,90); - Changes the view to angles 0 and 90.
  7. SGplot(B,'g'); - Plots the transformed object B in green.
Algorithm explaination created using ChatGPT on 2025-08-18 23:02. (Please note: No guarantee for the correctness of this explanation)

Last html export of this page out of FM database by TL: 2025-09-21