CPLsplitbool

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Boolean
Introduced first in SolidGeometry 4.4, Creation date: 2019-01-27, Last change: 2025-09-14

returns a CPL that is split into two pre more parts by a second contour

Description

This function is helpful in combination with a interactive selected contour.

See Also: CPLbool , CPLboolpshape , CPLmeltbool , CPLsplitui

Example Illustration

 missing image of CPLsplitbool(CPLA,CPLC);

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

Output Results

Algorithm Steps

  1. Initialize CPLB using the function getfuncparams with default as an empty array.
  2. If CPLB is empty, plot CPLA and use VLui to interactively select a contour for CPLB.
  3. Compute the XOR of CPLA and CPLB using CPLbool('x',CPLA,CPLB).
  4. Compute the subtraction of CPLA and a buffered version of the XOR result using CPLbool('-',CPLA,CPLbuffer(xor,1e-3)).
  5. Assign the results to CPLsub and CPLxor.
  6. 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