CPLfindsmalldist

by Tim Lueth & Andreas Schroeffer, SG-Lib Toolbox: SolidGeometry 5.6 - CPL/Closed Polygon Lists
Introduced first in SolidGeometry 4.5, Creation date: 2019-04-17, Last change: 2025-09-14

returns areas of a CPL that have a small wall distance to the opposite contour



See Also: CPLbuffer

Example Illustration

 missing image of CPLfindsmalldist(CPL,z)

Syntax

[CPLF,CPLX]=CPLfindsmalldist(CPL,[z])

Input Parameter

CPL: Closed Contour
z: minimalcontour thickness; default is 0.5mm

Output Parameter

CPLF: Lost Contours; if empty, the contour has no problems
CPLX: Remaining Contour;

Examples


CPLfindsmalldist(PLstar(10,'','','','',.5),2);
CPLfindsmalldist(PLstar(10,'','','','',.5),1);
CPLfindsmalldist(PLgearDIN(.1,80));




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

Algorithm (Workflow)

This function, CPLfindsmalldist, is designed to identify areas of a closed polygon list (CPL) that have a small wall distance to the opposite contour. It is part of the SolidGeometry library.

Input Parameters

Output Results

Algorithm Steps

  1. The function begins by determining the value of z using the getfuncparams function. If z is not provided, it defaults to 0.5 mm. The value of z is then halved.
  2. The function applies a buffer operation on the CPL using the CPLbuffer function. It first shrinks the CPL by -z and then expands it back by z. This results in a modified contour, CPLR.
  3. The function calculates the lost contours, CPLF, by performing a boolean subtraction between the original CPL and the modified contour CPLR using the CPLbool function.
  4. The remaining contour, CPLX, is determined by subtracting a buffered version of CPLF (with a small buffer of 0.001) from the original CPL.
  5. If no output arguments are specified, the function plots the results using the CPSplot function. The lost contours are plotted in red, and the remaining contours are plotted in green.
Algorithm explaination created using ChatGPT on 2025-08-19 00:49. (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