Syntax
[SG,FLW,FLA,FLB]=SGofCPLz(CPL,z,[T,"STL","wall","cover","csub","floor","T"])
Input Parameter
CPL : | | Contour polygon list (CPL) |
z : | | Height z can be scalar or [zmin zmax] |
T : | | optional Transformation after Solid creation; useful for cutting blades |
"STL" : | | if wall>0; CPL is the outside contour and wall is the thickness |
"wall" : | | if cover>0; The solid gets a conver |
"cover" : | | if floor>0; The solid gets a floor |
"csub" : | | this contour is subtracted from the cover contour |
"floor" : | | this contour is subtracted from the floor contour |
Output Parameter
SG : | | Vertex list, Facet list, Point list, Edge list |
FLW : | | Facet list of wall |
FLA : | | Facet list of floor |
FLB : | | Facet list of ceiling |
Examples
Create a cylinder:
SG=SGofCPLz(PLcircle(10),10);
SGB=SGofCPLz(PLcircle(10),10,TofR([pi/6 pi/6 pi/6],[30 30 30]));
SGfigure(-30,30); SGplotalpha(SG,'w'), SGplotalpha(SGB,'g')
SGofCPLz(PLsquare(20),40,'wall',1.2,'floor',1.2,'flsub',PLcircle(3)); %% Squared tube with cirluar hole in floor
Copyright 2014-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, SGofCPLz, generates a 2.5D extruded solid volume from a contour polygon list (CPL) using Delaunay triangulation. The function can handle various parameters to modify the resulting solid.
Input Parameters
- CPL: Contour polygon list, which can be a scalar or a list of points.
- z: Height of the extrusion, can be a scalar or a range [zmin zmax].
- T: Optional transformation applied after solid creation.
- "STL": If wall > 0, CPL is the outside contour, and wall is the thickness.
- "wall": If cover > 0, the solid gets a cover.
- "cover": If floor > 0, the solid gets a floor.
- "csub": This contour is subtracted from the cover contour.
- "floor": This contour is subtracted from the floor contour.
Output Results
- SG: Contains vertex list, facet list, point list, and edge list.
- FLW: Facet list of the wall.
- FLA: Facet list of the floor.
- FLB: Facet list of the ceiling.
Algorithm Steps
- Check if CPL is empty; if so, return an empty SG.
- If CPL is a scalar, convert it to a circle using PLcircle.
- If aux > 0, add auxiliary points to CPL using CPLaddauxpoints.
- Repair CPL using CPLrepair to ensure no crossings or overlaps.
- If wall thickness (w) is specified, buffer CPL and create a new contour.
- Generate vertex, facet, point, and edge lists using VLFLofCPLz.
- If cover (c) is specified, create a cover using SGofCPLz and align it to the top.
- If floor (f) is specified, create a floor using SGofCPLz and align it to the bottom.
- If a transformation (T) is specified, apply it to SG using SGtransT.
- Strip unnecessary fields from SG.
- If no output is specified, plot SG and optionally write to STL.
Algorithm explaination created using ChatGPT on 2025-08-18 18:50. (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