Syntax
D=planedistanceofT(T,VL)
Input Parameter
T : | | Transformationmatrix 4x4 |
VL : | | Vertex list |
Output Parameter
Examples
VL=rand(10,3), planedistanceofT(TofR(rot(0,pi/2,0)),VL)
Copyright 2018-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 distance of a list of vertices to a plane defined by a transformation matrix in homogeneous coordinates.
Input Parameters
- T: A 4x4 transformation matrix representing the plane in homogeneous coordinates.
- VL: A list of vertices, where each vertex is a point in 3D space.
Output
- D: A vector containing the distances of each vertex in the list to the plane.
Algorithm Steps
- Calculate the inverse of the transformation matrix
T
and store it in iT
.
- Determine the number of vertices
nv
in the vertex list VL
.
- Initialize a distance vector
D
with NaN
values of size nv
.
- Extract the plane normal vector
zc
and the plane constant tc
from iT
.
- For each vertex in
VL
:
- Calculate the distance to the plane using the dot product of
zc
and the vertex, plus tc
.
- Store the result in the corresponding position in
D
.
- Round the distance values in
D
to 12 decimal places.
- If no output is requested, plot the plane and vertices using helper functions
SGfigure
, tfplot
, tplot
, and VLplot
.
Algorithm explaination created using ChatGPT on 2025-08-18 23: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