Syntax
CPLN=CPLcopypatternPL(CPL,PL,[dw])
Input Parameter
CPL : | | CPL to copy (nx2) |
PL : | | PL of relative Positions (nx2) |
dw : | | optional turing angle or turning array [nx1]; default is 0 |
Output Parameter
Examples
CPLcopypatternPL(PLcircle(1),20*rand(10,2))
CPLcopypatternPL(PLcircle(1,4),20*rand(10,2),pi/10)
Copyright 2015-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, CPLcopypatternPL
, is designed to copy a Closed Polygon List (CPL) to the positions specified by a Position List (PL). It is part of the SolidGeometry library.
Input Parameters
- CPL: The Closed Polygon List to be copied. It is an nx2 matrix where each row represents a point in 2D space.
- PL: The Position List of relative positions. It is also an nx2 matrix where each row represents a position in 2D space.
- dw (optional): A turning angle or an array of turning angles. It can be a single value or an nx1 array. The default value is 0.
Output Results
- CPLN: The final Closed Polygon List after copying and transforming. It is an nx2 matrix.
Algorithm Steps
- Initialize
dw
to 0. If a third argument is provided and is not empty, set dw
to this value.
- Determine the number of positions (
np
) from the size of PL
.
- Determine the number of points in
CPL
(nc
) and add 1 to account for closure.
- Initialize
CPLN
as a NaN-filled matrix with dimensions np*nc
by 2.
- If
dw
is a single value, replicate it to match the number of positions.
- Loop over each position in
PL
:
- If
dw
is an array, rotate CPL
by the corresponding angle and translate it to the current position in PL
.
- If
dw
is a single value, simply translate CPL
to the current position in PL
.
- Append the transformed CPL to
CPLN
and add a NaN row for separation.
- Remove the last row of
CPLN
to clean up the extra NaN row.
- If no output is requested, plot the resulting
CPLN
using CPLplot
.
Algorithm explaination created using ChatGPT on 2025-08-19 06:56. (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