CPLsubtract

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Boolean
Introduced first in SolidGeometry 4.9, Creation date: 2020-07-20, Last change: 2025-09-14

returns a Boolean subtraction of 2 CPLs

Description

simply based on CPLbool

See Also: CPLbool , CPLunion , CPLintersect , CPLxor , CPLtransrelCPL

Example Illustration

 missing image of CPLsubtract(A,B,rel);

Syntax

CPL=CPLsubtract(A,B,[rel]);

Input Parameter

A: CPL A
B: CPL B
rel: list of spatial relations same of CPLtransrelCPL

Output Parameter

CPL: Resulting Boolean

Examples


CPLsubtract(PLcircle(10),PLcircle(5)+[7 0]);
CPLsubtract(PLcircle(10),PLcircle(5),'ontop',-2);




Copyright 2020-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, CPLsubtract, performs a Boolean subtraction of two closed polygon lists (CPLs), A and B. It is part of the SolidGeometry library and was introduced in version 4.9.

Input Parameters

Output

Algorithm Steps

  1. The function begins by checking if any spatial relations are provided in varargin. If so, it applies these relations to B using the CPLtransrelCPL function.
  2. It then calls the CPLbool function with the '-' operator to perform the subtraction of B from A.
  3. If no output argument is specified, the function visualizes the result using SGfigure and plots A, B, and the resulting CPL in different colors (green, red, and magenta, respectively).
  4. Annotations are added to the plot to label the colors corresponding to each CPL.

Example Usage

Two examples are provided to demonstrate the function:

Algorithm explaination created using ChatGPT on 2025-08-19 00:30. (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