PLsquare

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - PL/Point Lists
Introduced first in SolidGeometry 1.0, Creation date: 2013-04-23, Last change: 2025-09-14

returns a 4 point list describing a rectangle or trapeze in 2D

Description

This is a basic point list generation function. See also PLcircle

See Also: PLcircle , PLcircseg , PLevolvente , PLgearDIN , PLkidney , PLrand , PLspiral , PLstar

Example Illustration

 missing image of PLsquare(YX,Y,dx)

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

PL: 2D Point list

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

Output

Algorithm Steps

  1. Retrieve the first parameter, X, using getfuncparams. Default is 5 if not provided.
  2. Set Y to X. If X is a vector of length 2, set Y to the second element and X to the first.
  3. Retrieve the second parameter, Y, using getfuncparams. Default is the current value of Y.
  4. Retrieve the third parameter, dx, using getfuncparams. Default is 0.
  5. Check if X is a vector of length 4, indicating a bounding box format:
  6. If X is not a bounding box, proceed with the standard rectangle format:
  7. 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