{"id":15038962,"url":"https://github.com/david-livadaru/dlangle","last_synced_at":"2026-02-04T07:06:23.880Z","repository":{"id":56907587,"uuid":"82384451","full_name":"david-livadaru/DLAngle","owner":"david-livadaru","description":"Provides an abstraction for mathematical angle written in Swift 4.","archived":false,"fork":false,"pushed_at":"2018-03-25T10:22:19.000Z","size":227,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-03-15T15:21:37.216Z","etag":null,"topics":["angle","carthage","cross-platform","swift-4","swift-package-manager","swift4"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/david-livadaru.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-18T12:16:05.000Z","updated_at":"2018-03-25T10:22:21.000Z","dependencies_parsed_at":"2022-08-20T19:50:25.534Z","dependency_job_id":null,"html_url":"https://github.com/david-livadaru/DLAngle","commit_stats":null,"previous_names":["davidlivadaru/dlangle"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/david-livadaru%2FDLAngle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/david-livadaru%2FDLAngle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/david-livadaru%2FDLAngle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/david-livadaru%2FDLAngle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/david-livadaru","download_url":"https://codeload.github.com/david-livadaru/DLAngle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243428437,"owners_count":20289317,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angle","carthage","cross-platform","swift-4","swift-package-manager","swift4"],"created_at":"2024-09-24T20:40:58.229Z","updated_at":"2026-02-04T07:06:23.838Z","avatar_url":"https://github.com/david-livadaru.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\" markdown=\"1\"\u003e\n\n![DLAngle Logo](DLAngleLogo.png)\n\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![CocoaPods compatible](https://img.shields.io/badge/CocoaPods-compatible-4BC51D.svg?style=flat)](https://github.com/CocoaPods/CocoaPods)\n[![Swift Package Manager](https://img.shields.io/badge/Swift_Package_Manager-compatible-orange.svg?style=flat)](https://swift.org/package-manager/)\n[![Swift 4.0](https://img.shields.io/badge/Swift_4.0-compatible-orange.svg?style=flat)](https://swift.org)\n\t\n\u003c/div\u003e\n\n\nProvides an abstraction for mathematical angle.\nBecause the angle is a type, errors such as:\n\n* sum or subtract a degree angle with a radian angle\n* pass degree angle to a trigonometric function from standard library\n\nare either not possible or catched at compile time.\nSupport convenience initializers, operators and functions for natural, fast and productive workflow.\n\n## Table of contents\n\n- [Usage](https://github.com/davidlivadaru/DLAngle#usage)\n\t- [Importing the module](https://github.com/davidlivadaru/DLAngle#importing-the-module)\n\t- [Creation](https://github.com/davidlivadaru/DLAngle#creation)\n\t- [Converting between Degree and Radian](https://github.com/davidlivadaru/DLAngle#converting-between-degree-and-radian)\n\t- [Basic Operations](https://github.com/davidlivadaru/DLAngle#basic-operations)\n\t- [Normalization](https://github.com/davidlivadaru/DLAngle#normalization)\n\t- [Equality](https://github.com/davidlivadaru/DLAngle#equality)\n\t- [Comparison](https://github.com/davidlivadaru/DLAngle#comparison)\n\t- [Foundation.Measurement conversion](https://github.com/davidlivadaru/DLAngle#foundationmeasurement-conversion)\n\t- [Inverse trigonometric functions](https://github.com/davidlivadaru/DLAngle#inverse-trigonometric-functions)\n\t- [Trigonometric functions](https://github.com/davidlivadaru/DLAngle#trigonometric-functions)\n\t- [Constants](https://github.com/davidlivadaru/DLAngle#constants)\n- [Installation](https://github.com/davidlivadaru/DLAngle#installation)\n\t- [Supported Operating Systems](https://github.com/davidlivadaru/DLAngle#supported-operating-systems)\n\t- [Carthage](https://github.com/davidlivadaru/DLAngle#1-carthage)\n\t- [CocoaPods](https://github.com/davidlivadaru/DLAngle#2-cocoapods)\n\t- [Swift Package Manager](https://github.com/davidlivadaru/DLAngle#3-swift-package-manager)\n- [Contribution](https://github.com/davidlivadaru/DLAngle#contribution)\n- [License](https://github.com/davidlivadaru/DLAngle#license)\n\n## Usage\n\n### Importing the module\n\nYou can import this module using:\n\n```swift\nimport DLAngle\n```\n\n### Creation\n\n```swift\nlet degree = Degree(rawValue: 90.0)\nlet zeroDegrees = Degree()\nlet radian = Radian(rawValue: Double.pi / 2)\nlet zeroRadians = Radian()\n```\n\n### Converting between Degree and Radian\n\nFrom Degree to Radian:\n\n```swift\nlet degree = Degree(rawValue: 90.0)\nlet radian = Radian(degree: degree)\n```\n\nFrom Radian to Degree:\n\n```swift\nlet radian = Radian(rawValue: Double.pi)\nlet degree = Degree(radian: radian)\n```\n\n### Basic Operations\n\nAddition\n\n```swift\nlet radian = Radian(degrees: 90.0)\nradian += Radian(degress: 45.0)\n// radian.rawValue = 3 * Double.pi / 4\n```\n\nSubtraction\n\n```swift\nvar degrees = Degree(radians: Double.pi / 2)\ndegrees = degrees - Degree(radians: Double.pi / 6)\n// degrees.rawValue = 60.0\n```\n\nMultiplcation\n\n```swift\nlet half = Radian(rawValue: Double.pi / 2)\nlet pi = one * 2 \n// '2 * one' works as well\n```\n\nDivision\n\n```swift\nlet pi = Radian(rawValue: Double.pi)\nlet sixtyDegreesRadian = one / 3 \n// '1 / pi' works as well\n```\n\n### Normalization\n\n```swift\nlet degree = Degree(rawValue: 750.0)\ndegree.normalize()\n// degree.rawValue = 30.0\nlet angle1 = Radian(rawvalue: 7 * Double.pi)\nlet angle2 = angle1.normalized()\n// angle2.rawValue = Double.pi\n```\n\n### Equality\n\n```swift\nlet angle1 = Radian(rawValue: Double.pi)\nlet angle2 = Radian(degrees: 180.0)\nangle1 == angle2 // true\n```\n\n### Comparison\n\n```swift\nlet angle1 = Radian(rawValue: Double.pi)\nlet angle2 = Radian(degrees: 90.0)\nangle1 \u003c angle2 // false\n```\n\n### Foundation.Measurement conversion\n\n```swift\nlet angleMeasurement = Measurement\u003cUnitAngle\u003e(value: 45.0, unit: .degrees)\nlet radian = Radian(measurement: angleMeasurement)\nradian.measurement // Measurement\u003cUnitAngle\u003e(value: Double.pi / 4, unit: .radians)\nlet degrees = Degrees(measurement: angleMeasurement)\ndegrees.measurement // Measurement\u003cUnitAngle\u003e(value: 45.0, unit: .degrees)\n```\n\n### Inverse trigonometric functions\n\nInverse functions are provided by using convenience constructors of Radian type.\n\n```swift\ndo {\n   let angle = try Radian(acos: -1.0)\n} catch {\n   // handle error\n}\n```\n\n### Trigonometric functions\n\n```swift\nlet angle = Radian(degrees: 45.0)\nif let sin: Double = try? angle.sin() {\n   // use computed sine value\n}\n```\n\n### Constants\n\nFrequently used Radian angles have constants:\n\n```swift\nlet pi = Radian.pi\nlet half_quadrant_II = Radian.pi_2 + Radian.pi_4\n```\n\n## Installation\n\n### Supported Operating Systems\n\n* **macOS** 10.12 and later\n* **iOS** 10.0 and later\n* **watchOS** 3.0 and later\n* **tvOS** 10.0 and later\n* **Ubuntu** - check [official site](https://swift.org/download/#releases) to find which versions support Swift 4.0.\n\n### 1. [Carthage](https://github.com/Carthage/Carthage)\n\n```\ngithub \"davidlivadaru/DLAngle\"\n```\n\nIf you need the framework only for a single OS, then I propose to use `--platform [iOS|macOS|watchOS|tvOS]` specifier when your perform `carthage update`.\n\n### 2. [CocoaPods](https://github.com/CocoaPods/CocoaPods)\n\nAdd the dependency in your `Podfile`.\n\n```\npod 'DLAngle'\n```\n\n### 3. [Swift Package Manager](https://swift.org/package-manager/)\n\nAdd the the following dependecy in your [`Package.swift`]((https://swift.org/package-manager/#example-usage)):\n\n```\ndependencies: [\n    .package(url: \"https://github.com/davidlivadaru/DLAngle.git\", .upToNextMajor(from: \"1.0.0\"))\n]\n```\n\nand update your target's dependencies: \n\n```\ntargets: [\n        .target(\n            name: \"YourTargetName\",\n            dependencies: [\"DLAngle\"])),\n    ]\n```\n\n## Contribution\n\nModule is covered by unit tests, however, bugs always slip through.\nIf you find a bug in the module create an [issue](https://github.com/davidlivadaru/DLAngle/issues).\n\nIf you want to contribute on fixing bugs or implementing new features then create a [pull request](https://github.com/davidlivadaru/DLAngle/pulls).\n\n## License\n\n**DLAngle** is released under MIT license. See [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavid-livadaru%2Fdlangle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavid-livadaru%2Fdlangle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavid-livadaru%2Fdlangle/lists"}