SGofCPLz

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - SG/Solids
Introduced first in SolidGeometry 1.6, Creation date: 2014-11-21, Last change: 2025-09-14

returns a 2½D extruded Solid volume from a contour polygon list (CPL)

Description

The function uses Delaunay-Triagulation to tesselate the base plate and the cover plate of the part. Therefor, make sure that there are no crossings or overlapping contours in CPL.
IT SHOULD BE CLEAR THAT FACETS ARE TURNED FOR NEGATIVE Z VALUES. =>SGswap, FLswap, FL=FL(:,[1 3 2])
New in SG-Lib Rel 4.7: height z can be scalar or [zmin zmax]
With 2024 there are different results in matlab wrt polyshape-simplify, the split points have identical coordinates. Therfore, it was necessary to use CPLrepair again since 5.4 (2024a) as in 2018.

See Also: SGofCPLsphere , SGofCPLT , SGofCPLrot , SGofCPLzchamfer , SGofCPLrota , CPLrepair

Example Illustration

 missing image of SGofCPLz(CPL,z,T,

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

Output Results

Algorithm Steps

  1. Check if CPL is empty; if so, return an empty SG.
  2. If CPL is a scalar, convert it to a circle using PLcircle.
  3. If aux > 0, add auxiliary points to CPL using CPLaddauxpoints.
  4. Repair CPL using CPLrepair to ensure no crossings or overlaps.
  5. If wall thickness (w) is specified, buffer CPL and create a new contour.
  6. Generate vertex, facet, point, and edge lists using VLFLofCPLz.
  7. If cover (c) is specified, create a cover using SGofCPLz and align it to the top.
  8. If floor (f) is specified, create a floor using SGofCPLz and align it to the bottom.
  9. If a transformation (T) is specified, apply it to SG using SGtransT.
  10. Strip unnecessary fields from SG.
  11. 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