Syntax
PL=PLsquare([YX,Y,dx])
Input Parameter
YX : | | Dimension in X or [x y] |
Y : | | Dimension in X, default Y=X or X(2) |
dx : | | optional deisplacement to create a trapeze |
Output Parameter
Examples
Generate a simple point list for a rectangle:
CPLplot(PLsquare(10,20),'b-',3)
CPLplot(PLsquare(10,20,10),'b-',3)
CPLplot(PLsquare(10,20,-5),'b-',3)
Copyright 2013-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, PLsquare
, generates a 2D point list describing a rectangle or trapeze. It is part of the SolidGeometry library and was introduced by Tim Lueth.
Input Parameters
- YX: This can be a single dimension in X or a vector [x y].
- Y: Dimension in Y. If not provided, it defaults to X or the second element of X if X is a vector.
- dx: An optional displacement to create a trapeze. Defaults to 0.
Output
- PL: A 2D point list representing the rectangle or trapeze.
Algorithm Steps
- Retrieve the first parameter,
X
, using getfuncparams
. Default is 5 if not provided.
- Set
Y
to X
. If X
is a vector of length 2, set Y
to the second element and X
to the first.
- Retrieve the second parameter,
Y
, using getfuncparams
. Default is the current value of Y
.
- Retrieve the third parameter,
dx
, using getfuncparams
. Default is 0.
- Check if
X
is a vector of length 4, indicating a bounding box format:
- Call
CPLofBB
with X
and 0 to get the point list.
- Extract the first four points from the list.
- Adjust the x-coordinates of the third and fourth points by adding
dx
.
- If
X
is not a bounding box, proceed with the standard rectangle format:
- If
Y
is not zero, create a point list for a rectangle with optional displacement dx
.
- If
Y
is zero, call PLcircle
with X/2
and add dx
to the result.
- If no output is requested, plot the point list using
SGfigure
and VLplot
.
Algorithm explaination created using ChatGPT on 2025-08-19 08:08. (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