CPLintersect

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 intersection of 2 CPLs

Description

simply based on CPLbool

See Also: CPLbool , CPLsubtract , CPLunion , CPLxor

Example Illustration

 missing image of CPLintersect(A,B);

Syntax

CPL=CPLintersect(A,B);

Input Parameter

A: CPL A
B: CPL B

Output Parameter

CPL: Resulting Boolean

Examples


CPLintersect(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 function, CPLintersect, computes the Boolean intersection 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. Check if there are any additional transformation parameters in varargin. If present, transform CPL B relative to CPL A using CPLtransrelCPL.
  2. Call the function CPLbool with the operation 'ISEC' to compute the intersection of CPL A and CPL B.
  3. If no output is requested (i.e., nargout == 0), visualize the result:
    • Open a new figure with SGfigure and set the view to top-down (0, 90 degrees).
    • Plot CPL A in green, CPL B in red, and the resulting CPL in magenta using CPLplot.
    • Use CPSplot to plot the resulting CPL with specific styling.
    • Add a plot annotation to describe the color coding of the plot.

Example

The function can be used as follows: CPLintersect(PLcircle(10,6),PLcircle(5,6)+[7 0]);

This example computes the intersection of two circles, one with a radius of 10 and the other with a radius of 5, where the second circle is translated by 7 units along the x-axis.

Algorithm explaination created using ChatGPT on 2025-08-18 23:34. (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