Syntax
CPLN=CPLcopypattern(CPL,number,delta)
Input Parameter
CPL : | | Original Polygon |
number : | | copy vector [nx ny] |
delta : | | distance vector [dx dy] |
Output Parameter
CPLN : | | New closed polygon line |
Examples
A=CPLcopypattern;
SGofCPLz(A,40);view (-30,30);
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, CPLcopypattern
, is designed to create patterns by copying closed polygon lists (CPLs). It is part of the SolidGeometry library and was introduced in version 2.4. The function takes an original polygon and generates a new pattern by replicating the polygon according to specified parameters.
Input Parameters
- CPL: The original polygon, represented as a list of coordinates.
- number: A vector [nx, ny] indicating the number of copies in the x and y directions.
- delta: A vector [dx, dy] specifying the distance between copies in the x and y directions. If not provided, it defaults to the size of the original polygon.
Output
- CPLN: The new closed polygon line, which is a pattern created by copying the original polygon.
Algorithm Steps
- Initialize
delta
to the size of the original polygon if not provided.
- Check the number of input arguments. If none are provided, set default values for
CPL
, number
, and delta
.
- If
number
is a scalar, convert it to a vector [number, 1].
- If
delta
is a scalar, replicate it to match the size of number
.
- Initialize
phi
to 0, which is used for rotation (though not applied in this function).
- Start with
CPLA
as the original CPL
.
- For each copy in the x-direction (from 2 to
number(1)
), translate the original polygon by (i-1)*delta(1)
in the x-direction and append it to CPLA
.
- Set
CPLN
to CPLA
.
- For each copy in the y-direction (from 2 to
number(2)
), translate CPLA
by (i-1)*delta(2)
in the y-direction and append it to CPLN
.
- If no output is requested, plot the resulting pattern using
CPLplot
and display it in a new figure.
Algorithm explaination created using ChatGPT on 2025-08-19 07:16. (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