PLdiamond

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - CPL/Closed Polygon Lists
Introduced first in SolidGeometry 5.4, Creation date: 2024-07-28, Last change: 2025-09-15

returns a diamond shape optonal als convex hull for a CPL



See Also: PLknurled , PLcircle , PLcircseg , PLevolvente , PLgearDIN , PLkidney , PLrand , PLspiral , PLsquare

Example Illustration

 missing image of PLdiamond(dim,al)

Syntax

PL=PLdiamond([dim,al])

Input Parameter

dim: [width height] or CPL
al: angle, currently unsused, i.e. 45 deg

Output Parameter

PL: CPL of a diamond in dim or that is a hull for the CPL

Examples


PLdiamond([10 20]) % PLdiamond with size dimension
PLdiamond(PLstar(8)) % PLdiamond with a shape




Copyright 2024-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)

The function PLdiamond generates a diamond shape, optionally as a convex hull for a Closed Polygon List (CPL). It is part of the SolidGeometry library.

Input Parameters

Output

Algorithm Steps

  1. Retrieve the dim parameter using getfuncparams, defaulting to [6 10] if not provided.
  2. Retrieve the al parameter using getfuncparams, defaulting to 60 degrees in radians.
  3. Initialize CPL as an empty array and r as 0.
  4. If dim has more than one row, treat it as a CPL:
    • Calculate the radius r using rofcirclearoundCPL.
    • Calculate r4 as four times r using dofn(4).
    • Set dim to [2*r4 2*r4].
  5. Divide dim by 2 to get half-dimensions.
  6. Create the diamond shape PL using the half-dimensions:
    • Vertices are defined as [0 -dim(2); dim(1) 0; 0 dim(2); -dim(1) 0].
  7. If no output is requested (nargout==0):
    • Call SGfigure to set up the figure.
    • If CPL is not empty, plot it using CPSplot.
    • Plot the diamond PL using CPLplot.
    • If r is greater than 0, plot a circle with radius r using CPSplot and PLcircle.
Algorithm explaination created using ChatGPT on 2025-08-19 01:14. (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