CPLisidenticalregistered

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - CPL/Closed Polygon Lists
Introduced first in SolidGeometry 5.4, Creation date: 2023-12-20, Last change: 2025-09-15

Compares two CPLS in the same orientation and size



See Also: TregisterConvexHull , CPLisidenticalcontour

Example Illustration

 missing image of CPLisidenticalregistered(CPLA,CPLB,tol)

Syntax

[b,A]=CPLisidenticalregistered(CPLA,CPLB,[tol])

Input Parameter

CPLA: 1st CPL
CPLB: 2nd CPL
tol: tolerance in relative difference area; default is 0.1

Output Parameter

b: logical information
A: difference in area

Examples


CPL=CPLbox(10,'A');
CPLisidenticalregistered(CPL,PLtransP(CPL,[10 10]))
CPLisidenticalregistered(CPL,PLtransP(CPLbox(10),[10 10]))




Copyright 2023-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, CPLisidenticalregistered, compares two closed polygon lists (CPLs) to determine if they are identical in orientation and size, within a specified tolerance.

Input Parameters

Output Results

Algorithm Steps

  1. Check if both CPLA and CPLB are empty. If so, set b to true and return.
  2. If one is empty and the other is not, set b to false and return.
  3. Extract the first two columns of CPLA and CPLB to ensure they are 2D.
  4. Calculate the area of both CPLs using CPLarea.
  5. Add a z-coordinate to both CPLs using VLaddz.
  6. Register the convex hull of VLA and VLB using TregisterConvexHull to get the transformation matrix T.
  7. Transform VLB using the transformation matrix T with VLtransT.
  8. Compute the symmetric difference of the two polygons using CPLpolybool with the 'xor' operation.
  9. Calculate the area of the resulting polygon CPLD and normalize it by the maximum of AA and AB.
  10. Compare the normalized area A with the tolerance tol. If A is less than tol, set b to true; otherwise, set it to false.
  11. If no output arguments are specified, plot the polygons using SGfigure and CPSplot, coloring them green if identical and red if not.
Algorithm explaination created using ChatGPT on 2025-08-19 07:36. (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