SGselect3dPL

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Surfaces
Introduced first in SolidGeometry 4.9, Creation date: 2020-01-08, Last change: 2025-09-14

similar to select3d cals nearest point and vertices but for any fiven point



See Also: select3d , crosspointVLFL2 , SGselect3d , SGselect3Dsurface

Example Illustration

 missing image of SGselect3dPL(SG,p)

Syntax

[NL,FVL,fi]=SGselect3dPL(SG,[p])

Input Parameter

SG: Solid Geoemtry
p: point to be checked

Output Parameter

NL: List of point with nearest distance to PL
FVL: list of point on nearest vertex
fi: index of nearest vertex

Examples


SGselect3dPL(SGsample(3),[0 -6 80])
SGselect3dPL(SGsample(3),[0 -6 8])
SGselect3dPL(SGsample(3),[1 -6 8])
[a,b,c]=SGselect3dPL(SGsample(3),[1 -6 8])
[a,b,c]=SGselect3dPL(SGsample(3),[1 -6 80])




Copyright 2020-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)

The function SGselect3dPL is designed to find the nearest point and vertices on a 3D solid geometry (SG) to a given point p. It is part of the SolidGeometry library.

Input Parameters

Output Results

Algorithm Steps

  1. Retrieve the point p from the input parameters using getfuncparams.
  2. Extract the vertex list (VL) and face list (FL) from the solid geometry SG using SGofSG.
  3. Calculate the nearest vertex and its index using crosspointVLFL2, which returns the nearest vertex list FVL, distance di, index fi, and additional data a.
  4. Compute the Euclidean distance from each vertex in SG.VL to the point p using vecnormr.
  5. Identify the nearest point(s) NL by selecting vertices with the minimum distance.
  6. If no output arguments are specified, visualize the results:
Algorithm explaination created using ChatGPT on 2025-08-19 06:57. (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