by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - CPL/Closed Polygon Lists
Introduced first in SolidGeometry 5.1, Creation date: 2021-02-28, Last change: 2025-09-15
See Also: TLofPL
, CPLcirclesofPL
, SGpatternRotz
, CPLcopypattern
, CPLcopypatternPL
, SGpatternXYZ
, CPLcopyradial
CPLN=CPLcopypatternTL(CPL,TL,[dw])
CPL: | CPL to copy (nx2) | |
TL: | array of transformation matrices such from TLofPL | |
dw: | optional turing angle or turning array [nx1]; default is 0 |
CPLN: | Final CPL [nx2] |
CPLcopypatternPL(PLcircle(1),20*rand(10,2))
CPLcopypatternPL(PLcircle(1,4),20*rand(10,2),pi/10)
This function, CPLcopypatternTL, is designed to copy a Closed Polygon List (CPL) at positions defined by a Transformation List (TL). It is part of the SolidGeometry library.
TLofPL.dw to 0. If a third argument is provided and is not empty, set dw to this value.np) from the third dimension of TL.CPL plus one (nc).CPLN as a matrix of NaN values with dimensions (np*nc, 2).dw is a single value, replicate it to match the number of transformations.i from 0 to np-1:dw has more than one element, apply a rotation to CPL using PLtransR with the angle dw(i+1), then apply the transformation TL(i+1,:) using PLtransP.dw is a single value, apply the transformation directly using PLtransT with TL(:,:,i+1).[NaN NaN] to separate each transformed polygon.CPLN to clean up the output.CPLN using CPLplot with a red line style.Two example calls to the function are provided:
CPLcopypatternPL(PLcircle(1),20*rand(10,2)): Copies a circle with radius 1 at random positions.CPLcopypatternPL(PLcircle(1,4),20*rand(10,2),pi/10): Copies a circle with radius 1 and 4 segments at random positions with a turning angle of pi/10.