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
- dim: A vector specifying the dimensions of the diamond. It can be either [width height] or a CPL.
- al: An angle parameter, currently unused, defaulting to 45 degrees.
Output
- PL: A CPL representing a diamond shape based on the input dimensions or a hull for the CPL.
Algorithm Steps
- Retrieve the
dim
parameter using getfuncparams
, defaulting to [6 10] if not provided.
- Retrieve the
al
parameter using getfuncparams
, defaulting to 60 degrees in radians.
- Initialize
CPL
as an empty array and r
as 0.
- 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].
- Divide
dim
by 2 to get half-dimensions.
- 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].
- 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