Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kkla320/trigonometry
A small package to calculate values in an right angled triangle.
https://github.com/kkla320/trigonometry
spm swift
Last synced: 14 days ago
JSON representation
A small package to calculate values in an right angled triangle.
- Host: GitHub
- URL: https://github.com/kkla320/trigonometry
- Owner: kkla320
- Created: 2022-03-19T09:30:34.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-07-26T08:23:59.000Z (over 2 years ago)
- Last Synced: 2024-12-30T23:22:44.536Z (about 1 month ago)
- Topics: spm, swift
- Language: Swift
- Homepage:
- Size: 5.86 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Trigonometry
A small package to calculate values in an right angled triangle.
The package currently contains five functions
```swift
/// Calculates the opposite leg
/// - Parameter angle: The angle opposite to the leg
/// - Parameter hypothenuse: The value of the hypothenuse
/// - Returns: The value of the opposite leg
static func opposite(angle: Angle, hypothenuse: Self) -> Self
/// Calculates the adjacent leg
/// - Parameter angle: The angle adjacent to the leg
/// - Parameter hypothenuse: The value of the hypothenuse
/// - Returns: The value of the adjacent leg
static func adjacent(angle: Angle, hypothenuse: Self) -> Self
/// Calculates a leg
/// - Parameter hypothenuse: The value of the hypothenuse
/// - Parameter otherLeg: The value of the other leg
/// - Returns: The value of the leg
static func leg(hypothenuse: Self, otherLeg: Self) -> Self
/// Calculates an angle
/// - Parameter opposite: The opposite leg of the angle to calculate
/// - Parameter hypothenuse: The value of the hypothenuse
/// - Returns: The calculated angle
static func angle(opposite: Self, hypothenuse: Self) -> Angle
/// Calculates an angle
/// - Parameter adjacent: The adjacent leg of the angle to calculate
/// - Parameter hypothenuse: The value of the hypothenuse
/// - Returns: The calculated angle
static func angle(adjacent: Self, hypothenuse: Self) -> Angle
```## Use this package in your project
1. Add the following line to the dependencies in your Package.swift file:
```swift
.package(url: "https://github.com/kkla320/Trigonometry", from: "1.0.0"),
```
2. Add Trigonometry as a dependency for your target:
```swift
.target(name: "MyTarget", dependencies: [
"Trigonometry"
]),
```