Syntax
T=Txy(p,x,y)
Input Parameter
p : | | Origin of coordinate system |
x : | | x value of z-axis |
y : | | y value of z-axis |
Output Parameter
T : | | is the resulting homogenous transformation matrix |
Examples
Txy([0 0 0],.5,.5)
Copyright 2010-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, Txy, computes a homogeneous transformation matrix based on a given point and the x and y components of a vector along the z-axis. The function is part of the SolidGeometry library and was developed by Tim Lueth.
Input Parameters
- p: A vector representing the origin of the coordinate system. It is a 3-element vector [px, py, pz].
- x: The x-component of the z-axis vector.
- y: The y-component of the z-axis vector.
Output
- T: A 4x4 homogeneous transformation matrix.
Algorithm Steps
- Initialize a 4x4 zero matrix T.
- Set the last column of T to the point p, with T(4,4) set to 1 to maintain homogeneity.
- Calculate the z-component of the z-axis vector using the formula: z = sqrt(1 - x^2 - y^2).
- Check if x equals 1:
- If true, set the rotation part of T to a predefined matrix: [0 0 1; 0 1 0; -1 0 0].
- If false, compute the rotation matrix elements based on x, y, and z:
- Set T(1,3) = x, T(2,3) = y, T(3,3) = z.
- Calculate T(1,1) = sqrt(1 - x^2).
- Calculate T(2,1) = -x*y/sqrt(1 - x^2).
- Calculate T(3,1) = -x*z/sqrt(1 - x^2).
- Set T(1,2) = 0.
- Calculate T(2,2) = z/sqrt(1 - x^2).
- Calculate T(3,2) = -y/sqrt(1 - x^2).
- If no output is requested (nargout == 0), call SGfigure and tplot(T) to visualize the transformation matrix.
Algorithm explaination created using ChatGPT on 2025-08-19 00:51. (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