Syntax
CPL=CPLadd(CPLA,CPLB,[ibool])
Input Parameter
CPLA : | | CPLA A |
CPLB : | | CPLA B |
ibool : | | '+' drills the holes through all, 'x' finds contour that fits trough all holes |
Output Parameter
Examples
CPLadd(CPLsample(27),PLcircleoval(6,'',40,4));
CPLadd(PLcircleoval(6,'',40,4),CPLsample(27));
CPLadd(CPLsample(10),CPLsample(27));
CPLadd(CPLsample(27),CPLsample(10));
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 function, CPLadd
, is designed to manipulate closed polygon lists (CPLs) by adding outer contours and subtracting holes. It is particularly useful in mechanical design for handling overlaps of filled and open contours.
Input Parameters
- CPLA: The first closed polygon list.
- CPLB: The second closed polygon list.
- ibool: An optional parameter that determines how holes are handled. The default is '+', which drills holes through all. If 'x' is used, it finds contours that fit through all holes.
Output
- CPL: The final contour after processing.
Algorithm Steps
- Check if
CPLA
is empty. If it is, return CPLB
as the result.
- Use
CPLregionsholes
to separate outer contours and holes for both CPLA
and CPLB
:
[CPLAo, CPLAi] = CPLregionsholes(CPLA)
[CPLBo, CPLBi] = CPLregionsholes(CPLB)
- Combine the outer contours of
CPLA
and CPLB
using CPLbool
with the '+' operation:
CPLO = CPLbool('+', CPLAo, CPLBo)
- Combine the holes of
CPLA
and CPLB
using CPLbool
with the operation specified by ibool
:
CPLI = CPLbool(ibool, CPLAi, CPLBi)
- Subtract the combined holes from the combined outer contours using
CPLbool
with the '-' operation:
CPL = CPLbool('-', CPLO, CPLI)
- If no output is requested, plot the results using various plotting functions to visualize the contours and holes.
Algorithm explaination created using ChatGPT on 2025-08-19 07:03. (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