Skip to content

Commit

Permalink
Fix extrude with profiles
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasf committed Aug 1, 2024
1 parent 4f2f41f commit 244734a
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions Sources/SwiftSCAD/Operations/Extrude/ExtrudeWithEdgeProfiles.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,18 @@ public extension Geometry2D {
/// - Returns: The extruded 3D geometry.

func extruded(height: Double, topEdge: EdgeProfile?, bottomEdge: EdgeProfile?, method: EdgeProfile.Method) -> any Geometry3D {
extruded(height: height)
.intersection {
if let topEdge {
topEdge.mask(shape: self, extrusionHeight: height, method: method)
}
}
.intersection {
if let bottomEdge {
bottomEdge.mask(shape: self, extrusionHeight: height, method: method)
.flipped(along: .z)
.translated(z: height)
}
var shape = extruded(height: height)
if let topEdge {
shape = shape.intersection(topEdge.mask(shape: self, extrusionHeight: height, method: method))
}
if let bottomEdge {
shape = shape.intersection {
bottomEdge.mask(shape: self, extrusionHeight: height, method: method)
.flipped(along: .z)
.translated(z: height)
}
}
return shape
}

/// See ``extruded(height:topEdge:bottomEdge:method:)``
Expand Down

0 comments on commit 244734a

Please sign in to comment.