三角学

一个用于计算直角三角形数值的小型软件包。

该软件包目前包含五个函数。

/// 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<Self>, 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<Self>, 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<Self>
/// 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<Self>

在您的项目中使用这个软件包

  1. 将以下行添加到您的 Package.swift 文件中的 dependencies 中
.package(url: "https://github.com/kkla320/Trigonometry", from: "1.0.0"),
  1. 将 Trigonometry 添加为您的目标的依赖项
.target(name: "MyTarget", dependencies: [
  "Trigonometry"
]),