Skip to content

Commit

Permalink
Add rotated(from:to:)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasf committed Jun 26, 2024
1 parent 1aa6496 commit c804fdd
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Sources/SwiftSCAD/Transformations/Rotate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,15 @@ public extension Geometry3D {
func rotated(_ rotation: Rotation3D) -> any Geometry3D {
Rotate3D(body: self, rotation: rotation)
}

/// Rotate geometry from one direction vector to another.
///
/// - Parameters:
/// - from: A `Vector3D` representing the starting orientation of the vector.
/// - to: A `Vector3D` representing the desired orientation of the vector.
/// - Returns: An `AffineTransform3D` representing the rotation from the `from` vector to the `to` vector.

func rotated(from: Vector3D = .up, to: Vector3D) -> any Geometry3D {
transformed(.rotation(from: from, to: to))
}
}

0 comments on commit c804fdd

Please sign in to comment.