Syntax
CPLN=CPLsweep_simple(CPL,[w,cp])
Input Parameter
Output Parameter
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 algorithm is a function named CPLsweep_simple
from the SolidGeometry library, designed to perform a sweep operation on a closed polygon list (CPL). The function is marked as obsolete and is suggested to be replaced by CPLsweep
.
Input Parameters
- CPL: The closed polygon list to be processed.
- w: An optional parameter representing the angle of rotation, defaulting to
pi/4
if not provided.
- cp: An optional parameter representing a center point for transformations, defaulting to
[0 0]
if not provided.
Output Results
- CPLN: The resulting closed polygon list after the sweep operation.
Algorithm Steps
- Retrieve the parameters
w
and cp
using the getfuncparams
function, with default values if not specified.
- Store the original CPL in
CPLO
.
- Translate the CPL by subtracting the center point
cp
.
- Calculate the bounding box radius
r
using sofBB
and BBofVL
.
- Determine the number of rotations
n
using nofrd
with the radius r
and angle w
.
- Create a
polyshape
object pso
from the translated CPL.
- Calculate the incremental rotation angle
dw
as w/(n-1)
.
- Initialize
ps
with pso
.
- Iterate from 1 to
n-1
:
- Rotate the vertices of
pso
by i*dw
using PLtransR
.
- Create a new
polyshape
psi
from the rotated vertices.
- Union
psi
with ps
.
- Extract the vertices of the resulting
polyshape
into CPLN
.
- Translate
CPLN
back by adding the center point cp
.
- Create a
polyshape
ps
from CPLN
.
- If no output is requested, plot the results:
- Open a new figure with
SGfigure
.
- Plot the
polyshape
ps
.
- Plot the original and transformed CPLs with different styles and colors.
- Plot the center point
cp
as a blue star.
Algorithm explaination created using ChatGPT on 2025-08-19 07:51. (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