planedistanceofT

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Analytical Geometry
Introduced first in SolidGeometry 4.3, Creation date: 2018-10-07, Last change: 2025-09-14

returns the distance of a vertex list to a plane in HT coordinate form

Description

high speed function
In contrast to distT, this function returns only the distance value

See Also: distE , distT , VLisbelowT

Example Illustration

 missing image of planedistanceofT(T,VL)

Syntax

D=planedistanceofT(T,VL)

Input Parameter

T: Transformationmatrix 4x4
VL: Vertex list

Output Parameter

D: Distance vector

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

Output

Algorithm Steps

  1. Calculate the inverse of the transformation matrix T and store it in iT.
  2. Determine the number of vertices nv in the vertex list VL.
  3. Initialize a distance vector D with NaN values of size nv.
  4. Extract the plane normal vector zc and the plane constant tc from iT.
  5. 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.
  6. Round the distance values in D to 12 decimal places.
  7. 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