Created
November 16, 2017 22:28
-
-
Save erica/ee06008202c9fed699bfa6254c42c721 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Angle+Trig.swift | |
// SwiftPlaneGeometry | |
#if os(Linux) | |
/// #error No Linux Support | |
#else | |
import Darwin | |
#endif | |
extension Angle { | |
/// Returns sine | |
public var sin: Double { return Darwin.sin(radians) } | |
/// Returns cosine | |
public var cos: Double { return Darwin.cos(radians) } | |
/// Returns tangent | |
public var tan: Double { return Darwin.tan(radians) } | |
/// Returns hyperbolic sine | |
public var sinh: Double { return Darwin.sinh(radians) } | |
/// Returns hyperbolic cosine | |
public var cosh: Double { return Darwin.cosh(radians) } | |
/// Returns hyperbolic tangent | |
public var tanh: Double { return Darwin.tanh(radians) } | |
/// Returns cosecant | |
public var csc: Double { return 1 / sin } | |
/// Returns secant | |
public var sec: Double { return 1 / cos } | |
/// Returns cotangent | |
public var cot: Double { return 1 / tan } | |
} | |
extension Double { | |
/// Returns angle corresponding to arcsin | |
public var asin: Angle { return Angle(radians: Darwin.asin(self)) } | |
/// Returns angle corresponding to arccos | |
public var acos: Angle { return Angle(radians: Darwin.acos(self)) } | |
/// Returns angle corresponding to arctan | |
public var atan: Angle { return Angle(radians: Darwin.atan(self)) } | |
/// Returns angle corresponding to inverse hyperbolic sine function | |
public var asinh: Angle { return Angle(radians: Darwin.asinh(self)) } | |
/// Returns angle corresponding to inverse hyperbolic cos function | |
public var acosh: Angle { return Angle(radians: Darwin.acosh(self)) } | |
/// Returns angle corresponding to inverse hyperbolic tan function | |
public var atanh: Angle { return Angle(radians: Darwin.atanh(self)) } | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment