CPLxor

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 exclusive or of 2 CPLs

Description

simply based on CPLbool

See Also: CPLbool , CPLsubtract , CPLunion , CPLintersect

Example Illustration

 missing image of CPLxor(A,B);

Syntax

CPL=CPLxor(A,B);

Input Parameter

A: CPL A
B: CPL B

Output Parameter

CPL: Resulting Boolean

Examples


CPLxor(PLcircle(10,6),PLcircle(5,6)+[7 0]);




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 algorithm performs a Boolean exclusive OR (XOR) operation on two closed polygon lists (CPLs), A and B. The function is part of the SolidGeometry library and is designed to handle geometric operations on polygons.

Input Parameters

Output

Algorithm Steps

  1. Check if there are any additional transformation parameters in varargin. If present, apply a relative transformation to B using CPLtransrelCPL.
  2. Repair both CPLs A and B using the CPLrepair function to ensure they are in a suitable state for Boolean operations.
  3. Perform the XOR operation on the repaired CPLs A and B using the CPLbool function with the 'xor' operation type.
  4. Repair the resulting CPL to ensure it is in a valid state.
  5. If no output is requested (i.e., nargout==0), visualize the operation:
    • Open a new figure with a top-down view.
    • Plot CPL A in green, CPL B in red, and the resulting CPL in magenta.
    • Annotate the plot to indicate that the magenta color represents the intersection.
Algorithm explaination created using ChatGPT on 2025-08-19 00:11. (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