Syntax
[CPLA,CPLB,CPLC]=CPLsplitbool(CPLA,[CPLC]);
Input Parameter
CPLA : | | CPL to be splitted |
CPLC : | | CPL that overlaps with CPLA |
Output Parameter
CPLA : | | CPLA minus CPLB (BLUE) |
CPLB : | | XOR of CPLA and CPLC (RED) |
CPLC : | | CPLC used to cut; if interactive mode was used; |
Examples
loadweb chair.mat
SGfigure; CPLplot(cplchair,'b-',3);
VLui; CPLc=ans(:,1:2); CPLplot(CPLc,'r-');
CPLsplitbool(cplchair,CPLc);
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 algorithm is designed to split a closed polygon list (CPL) into two or more parts using another contour. It is part of the SolidGeometry library and is useful for interactive contour selection.
Input Parameters
- CPLA: The closed polygon list to be split.
- CPLC: The closed polygon list that overlaps with CPLA. This parameter is optional and can be provided interactively if not specified.
Output Results
- CPLA: The original CPLA minus the overlapping part with CPLC (represented in blue).
- CPLB: The exclusive OR (XOR) of CPLA and CPLC (represented in red).
- CPLC: The contour used to cut CPLA, if interactive mode was used.
Algorithm Steps
- Initialize CPLB using the function
getfuncparams
with default as an empty array.
- If CPLB is empty, plot CPLA and use
VLui
to interactively select a contour for CPLB.
- Compute the XOR of CPLA and CPLB using
CPLbool('x',CPLA,CPLB)
.
- Compute the subtraction of CPLA and a buffered version of the XOR result using
CPLbool('-',CPLA,CPLbuffer(xor,1e-3))
.
- Assign the results to
CPLsub
and CPLxor
.
- If no output arguments are specified, plot the results using
SGfigure
and various CPLplot
functions to visualize the split contours.
Algorithm explaination created using ChatGPT on 2025-08-19 07:19. (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