Syntax
RVL=VLswapYZ(VL)
Input Parameter
Output Parameter
RVL : | | Rotated vertex list. |
Copyright 2012-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, VLswapYZ
, is designed to perform a specific transformation on a list of vertices. It is part of the SolidGeometry library and was introduced to facilitate the manipulation of 3D coordinates, particularly for converting 2D drawings from the x/y plane to the x/z plane.
Input Parameters
- VL: This is the original vertex list. It is expected to be a matrix where each row represents a vertex with three coordinates [x, y, z].
Output Results
- RVL: This is the rotated vertex list. The transformation applied to each vertex is a rotation around the x-axis by +90 degrees, resulting in the new coordinates [x, -z, y].
Algorithm Explanation
The function performs a simple transformation on the input vertex list VL
. For each vertex in the list, the function rearranges the coordinates as follows:
- The x-coordinate remains unchanged.
- The y-coordinate is replaced by the negative of the z-coordinate.
- The z-coordinate is replaced by the y-coordinate.
This transformation effectively rotates the vertex list around the x-axis by +90 degrees, which is useful for converting 2D drawings from the x/y plane to the x/z plane.
Code Explanation
The core of the function is a single line of code:
RVL = [VL(:,1) -VL(:,3) VL(:,2)];
This line constructs the output matrix RVL
by selecting and rearranging the columns of the input matrix VL
:
VL(:,1)
: Selects the first column (x-coordinates) of VL
.
-VL(:,3)
: Selects the third column (z-coordinates) of VL
and negates it.
VL(:,2)
: Selects the second column (y-coordinates) of VL
.
The result is a new matrix RVL
where each vertex has been transformed according to the specified rotation.
Algorithm explaination created using ChatGPT on 2025-08-18 23:23. (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