CPLbufferEdges

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - CPL/Closed Polygon Lists
Introduced first in SolidGeometry 4.3, Creation date: 2018-11-03, Last change: 2025-09-14

returns contours with broken our rounded edges;

Description

ATTENTION = 'round' creates too many points wrt 3D printing
This function based on CPLbuffer / polybuffer(polyshape)
Square doubles the numver of points; round at least triples the number of points

See Also: CPLradialEdges

Example Illustration

 missing image of CPLbufferEdges(CPL,r,t)

Syntax

CPLN=CPLbufferEdges(CPL,[r,t])

Input Parameter

CPL: Closed Polygon Line
r: radius; default is 0.3
t: 'square', 'round'

Output Parameter

CPLN:

Examples


CPLbufferEdges([PLgearDIN(1,9);nan nan;PLcircle(.5)],.3,'round')
CPLbufferEdges([PLgearDIN(1,9);nan nan;PLcircle(.5)],.3,'square')




Copyright 2018-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, CPLbufferEdges, is designed to modify the edges of a closed polygon line (CPL) by either rounding or squaring them. It is part of the SolidGeometry library and was introduced in version 4.3.

Input Parameters

Output

Algorithm Steps

  1. Retrieve the radius r and type t from the input parameters using getfuncparams. If not provided, default values are used (0.3 for r and 'round' for t).
  2. Call CPLbuffer with the original CPL, a negative radius -r, and 'miter' to create an initial buffered polygon cpl.
  3. Apply CPLbuffer again on the buffered polygon cpl with the radius r and the specified type t ('square' or 'round') to obtain the final modified polygon CPLN.
  4. If no output is requested (nargout==0), plot the original and modified polygons using SGfigure, CPLplot, and CVLplot for visualization.

Notes

The function warns that using 'round' may create too many points, which can be problematic for 3D printing. 'Square' doubles the number of points, while 'round' at least triples them.

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