Swiftpack.co - pducks32/Hamilton as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by pducks32.
pducks32/Hamilton 1.0.3
A great way to manipulate vectors and quaternions in Swift
⭐️ 5
🕓 3 years ago
iOS macOS watchOS tvOS
.package(url: "https://github.com/pducks32/Hamilton.git", from: "1.0.3")

Hamilton

Swift Version License Platform

Requirements

Using Swift 4. Please be aware.

Basic Usage

  • Only Right handed coordinate systems are currently supported. Please be aware as Unity, Unreal, and DirectX use left handed systems.

Basic Operations

let baseVector = Vector3(1, 6, 5)
let otherVector = Vector3(7, 1, 3)

baseVector.adding(otherVector) //=> Vector3(8, 7, 8)
baseVector.magnitude //=> 7.874

Rotations

let baseVector = Vector3(0, 1, 0)

let quat = Quaternion(axis: .xAxis, angle: Degrees(90))
let eulerAngles = EulerAngles(pitch: 90.degrees, yaw: 0.degrees, roll: 0.degrees, system: .xyz)

baseVector.rotated(by: quat) //=> Vector3(0, 0, 1)
baseVector.rotated(by: eulerAngles) // -> Vector3(0, 0, 1)

Installation

Hamilton is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "Hamilton"

Author

Patrick Metcalfe, [email protected]

License

Hamilton is available under the MIT license. See the LICENSE file for more info.

GitHub

link
Stars: 5
Last commit: 3 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

6 years ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics