SGcylinder

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Surfaces
Introduced first in SolidGeometry 4.4, Creation date: 2018-11-15, Last change: 2025-09-14

returns a simple cylinder



See Also: SGbox , SGcone , SGsphere , SGarrow , SGspherelink , SGpinwrenchsize , SGspherelink , SGrodlink

Example Illustration

 missing image of SGcylinder(r,h,n,ri,ry,al)

Syntax

SG=SGcylinder([r,h,n,ri,ry,al])

Input Parameter

r: Radius
h: Height
n: number of points
ri: Inner Radius
ry: Radius in y
al: Angle of circle; default is 2*pi

Output Parameter

SG: Solid Geometry

Examples


SGcylinder(5,30)
SGcylinder(5,30,6)
SGcylinder(5,30,6,2)
SGcylinder(5,30,6,2,10)
SGcylinder(5,30,'',2,10,2*pi/1.5) % Elliptic with inner bore




Copyright 2018-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, SGcylinder, generates a 3D cylinder model using specified parameters. It is part of the SolidGeometry library.

Input Parameters

Output

Algorithm Steps

  1. Check for the 'frames' parameter using getfuncparamStr.
  2. Retrieve and set default values for r, h, n, ri, ry, and al using getfuncparams.
  3. Set d to 1. The variable d is intended for scaling but is not modified in this code.
  4. If h is a single value, convert it to a two-element array [0, h].
  5. If the first element of h is greater than the second, swap them to ensure correct height orientation.
  6. If ri is less than or equal to 0, create a solid cylinder using PLcircle and SGofCPLz.
  7. If ri is greater than 0, create a hollow cylinder by defining two circles and using SGofCPLz.
  8. If isframe is true, apply SGTsetBFsimple to the geometry.
  9. If no output is requested, plot the cylinder using SGfigure and SGTplotalpha.
Algorithm explaination created using ChatGPT on 2025-08-19 08:06. (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