Skip to content

Commit

Permalink
Add Cylinder truncated cone init for radii
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasf committed Mar 8, 2024
1 parent 35ae2a4 commit 36d31ac
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Sources/SwiftSCAD/Shapes/3D/Cylinder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,20 @@ public struct Cylinder: CoreGeometry3D {
self.centerZ = centerZ
}

/// Create a truncated right circular cone (a cylinder with different top and bottom radii)
/// - Parameters:
/// - bottomRadius: The radius at the bottom
/// - topRadius: The radius at the top
/// - height: The height between the top and the bottom
/// - centerZ: If true, center the cylinder along the Z axis

public init(bottomRadius: Double, topRadius: Double, height: Double, centerZ: Bool = false) {
self.diameter = bottomRadius * 2
self.topDiameter = topRadius * 2
self.height = height
self.centerZ = centerZ
}

func call(in environment: Environment) -> SCADCall {
var params: [String: any SCADValue] = ["h": height]

Expand Down

0 comments on commit 36d31ac

Please sign in to comment.