PLsetdiff

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - PL/Point Lists
Introduced first in SolidGeometry 5.1, Creation date: 2021-04-13, Last change: 2025-09-15

more tolerant than setdiff for vectors



See Also:

Example Illustration

 missing image of PLsetdiff(CPL,PL,tol)

Syntax

PLN=PLsetdiff(CPL,PL,[tol])

Input Parameter

CPL: Point list A
PL: Point list B
tol: Tolerance

Output Parameter

PLN: Returns a Point list CPL without PL

Examples


CPLsample(9); CPLA=ans; PLsetdiff(CPLA,[CPLA(3,:); CPLA(end-3,:)]); CPLB=ans
CPLinsertPL(CPLB,[CPLA(3,:);CPLA(end-3,:)])




Copyright 2021-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 algorithm is a custom implementation of the set difference operation for point lists, with added tolerance for numerical precision. It is designed to work with closed polygon lists (CPL) and point lists (PL).

Input Parameters

Output

Algorithm Steps

  1. Extract the first two columns of CPL and PL to ensure only 2D points are considered.
  2. Determine the number of points in CPL (np).
  3. Initialize a logical array isi of size np to false.
  4. Iterate over each point in CPL:
  5. Create PLN by excluding points in CPL that have a corresponding true value in isi.
  6. If rem is true, remove NaN values from PLN using woNaN.
  7. If no output is requested (nargout == 0), plot the results using SGfigure, CPSplot, PLplot, and CPLplot functions.
Algorithm explaination created using ChatGPT on 2025-08-19 00:12. (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