CVLpointdistancetoedge
by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - CVL/Closed Vertex Lists
Introduced first in SolidGeometry 4.5, Creation date: 2019-03-16, Last change: 2025-09-14
returns the edges that have the minimal distance to a point (Works in 3D)
Use carefully: The 'CVLpointdistancetoedge' function has not yet been extensively tested
Description
Tricky geometrical function, not easy to understand (STILL NOT PERFECT!)
ea can several entries for several contours (without filter) and also several nearest points (even with filter)
the colums have the following meaning:
1 = ci Index of contour within CVL
2 = si Index of starting point of edge within contour i
3 = md Minimal distance from point to edge
4 = mi Index of Point with minimal distance to point (si or si+1/1)
5 = mp minimal distance from point mi to p
See Also: , CPLinsertpoint
Example Illustration
Syntax
ea=CVLpointdistancetoedge(CVL,p,[filter])
Input Parameter
CVL: | | Vertex list separated by nans |
p: | | point n x 3 to check |
filter: | | if true only the nearest contour is returned; default is true |
Output Parameter
ea: | | [contourindex, startpointidex, distance to line/edge, minimaldistanceindex, distance to start/or end point] |
Examples
axis(BBgrow(axis,1.1));p=[ginput(1) 0];CVLpointdistancetoedge(VLaddz(CPLsample(29)),p,true)
CVLpointdistancetoedge(VLaddz(PLsquare(10,5)),[0 0 0])
CVLpointdistancetoedge(VLaddz(PLsquare(10,5)),[6 0 0])
CVLpointdistancetoedge(VLaddz(CPLsample(29)),[-8.2 5 0],false)
CVLpointdistancetoedge(VLaddz(CPLsample(29)),[-8.2 5 0],true)
Copyright 2019-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
Last html export of this page out of FM database by TL: 2025-09-21