by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Auxiliary function
Introduced first in SolidGeometry 4.4, Creation date: 2018-12-08, Last change: 2025-09-14
See Also: randminv
T=randT([d])
d: | distance from original; default is 10..20 |
T: | HT Matrix |
randT
This algorithm generates a random transformation matrix, often used in 3D graphics and robotics. The function is named randT and is part of the SolidGeometry library.
getfuncparams is called to retrieve the parameter d from the input arguments. If not specified, it defaults to 20.randminv is used to generate a random translation vector t with three components. Each component is a random value between d/2 and d.wx, wy, and wz are generated using randminv. These angles are within the range of [pi/10, 2*pi*0.9] - pi.rot is called with the angles wx, wy, and wz to create a rotation matrix R.TofR is used to combine the rotation matrix R and the translation vector t into a homogeneous transformation matrix T.nargout == 0), a figure is created using SGfigure. The maximum value of t is used to set the view, and the transformation is plotted with tplot. The origin is marked with pplot.