Syntax
[o,n]=distT(T,p)
Input Parameter
T : | | 4x4 Homogenous Transformation Matrix |
p : | | 1x3 or 3x1 vector |
Output Parameter
o : | | orthogonal vector: 1x3 |
n : | | normal vector: 1x3 |
Examples
T=TofR(rot(pi/16,pi/8,pi/12),[2 2 2]), p=[30 20 10]
distT(T,p)
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 calculates the orthogonal and normal vectors to a plane defined by a 4x4 homogeneous transformation matrix T, given a point p.
Input Parameters
- T: A 4x4 homogeneous transformation matrix representing a plane in 3D space.
- p: A 1x3 or 3x1 vector representing a point in 3D space.
Output Results
- o: The orthogonal vector from the point p to the plane defined by T.
- n: The normal vector to the plane at the point of intersection with the orthogonal vector.
Algorithm Steps
- Convert the point p into a column vector if it is not already.
- Calculate the orthogonal vector o using the function distE, which computes the shortest distance from the point to the plane.
- Transform the orthogonal vector back to the original coordinate system using the transformation matrix T.
- Extract the first three components of the transformed vector to get the final orthogonal vector o.
- Calculate the normal vector n as the difference between the point p and the orthogonal vector o.
- If no output arguments are specified, visualize the results using various plotting functions:
- Plot the transformation matrix T as a frame in 3D space.
- Plot the point p as a red star.
- Plot the orthogonal vector o as a magenta line.
- Plot the normal vector n as a red line.
Algorithm explaination created using ChatGPT on 2025-08-19 01:14. (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