Syntax
CVL=CVLofCPL(CPL,[T,d])
Input Parameter
CPL : | | Contour |
T : | | direction such as 'x' or HT matrix |
d : | | distance from origin; default is 0 |
Output Parameter
Examples
CVLofCPL(CPLsample(12),'y',100);
Copyright 2022-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, CVLofCPL
, converts a Closed Polygon List (CPL) into a Closed Volume List (CVL). It is part of the SolidGeometry library and was introduced in version 5.2.
Input Parameters
- CPL: A matrix representing the contour of the polygon. It is expected to have at least two columns representing the x and y coordinates.
- T: A transformation direction, which can be a character ('x', 'y', 'z') or a homogeneous transformation (HT) matrix. The default is 'z'.
- d: A scalar representing the distance from the origin. The default value is 0.
Output
- CVL: The resulting Closed Volume List after applying the transformation.
Algorithm Steps
- Extract the first two columns of the CPL to ensure it only contains x and y coordinates.
- Retrieve the transformation direction
T
using getfuncparams
, defaulting to 'z' if not provided.
- Retrieve the distance
d
using getfuncparams
, defaulting to 0 if not provided.
- If
T
is a character, convert it using ezofchar
. If T
has three elements, transform it using TofPez
with the product of d
and T
.
- Convert the 2D CPL into a 3D list by adding a z-coordinate using
VLaddz
.
- Apply the transformation
T
to the 3D list using VLtransT
to obtain the CVL.
Additional Code (Commented Out)
The commented-out section of the code suggests an alternative approach to handle different plane transformations using the xy
parameter. It involves:
- Determining the indices of the axes based on the
xy
string.
- Reordering the coordinates to match the specified plane.
- Handling NaN values in the CPL to ensure they are appropriately represented in the CVL.
Visualization
If no output is requested, the function visualizes the CVL using SGfigure
and CVLplot
, labeling the axes as x, y, and z.
Algorithm explaination created using ChatGPT on 2025-08-19 06:52. (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