by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Spatial Relations
Introduced first in SolidGeometry 2.4, Creation date: 2015-08-08, Last change: 2025-09-14
VL=VLtrans(VLA,T)
VLA: | Vertex list | |
T: | Transformation vector |
VL: | tranformed vertex list |
close all; SGfigure(-30,30); view(-30,30)
VLtrans(VLaddz(PLcircle(10,8)),0)
VLtrans(VLaddz(PLcircle(10,8)),1)
VLtrans(VLaddz(PLcircle(10,8)),[0 0 40])
VLtrans(VLaddz(PLcircle(10,8)),rot([pi/3,pi/3,pi/3]))
The function VLtrans is designed to transform a vertex list (VLA) using a specified transformation (T). It is part of the SG-Library and is used for spatial transformations.
0: Centers the vertices around the origin.1: Transforms the vertices to the first quadrant.[nx3]: A translation vector that shifts the vertices by the specified amounts in x, y, and z directions.[3x3]: A rotation matrix that rotates the vertices around the origin.[3x4]: A matrix that combines rotation and translation.[4x4]: A fully homogeneous transformation matrix that includes rotation, translation, and scaling.VLA has fewer than 3 columns. If so, add a z-coordinate of 0 using the function VLaddz.SG with fields VL (set to VLA) and FL (an empty array).SGtrans with the structure SG and the transformation T to perform the transformation.SG.VL and assign it to VL.nargout==0), plot the original and transformed vertex lists using SGfigure and VLplot.The function can be used in various ways, as shown in the examples:
VLtrans(VLaddz(PLcircle(10,8)),0): Centers a circle around the origin.VLtrans(VLaddz(PLcircle(10,8)),1): Transforms a circle to the first quadrant.VLtrans(VLaddz(PLcircle(10,8)),[0 0 40]): Translates a circle 40 units in the z-direction.VLtrans(VLaddz(PLcircle(10,8)),rot([pi/3,pi/3,pi/3])): Rotates a circle by pi/3 radians around each axis.