{"id":13663055,"url":"https://github.com/FreyaHolmer/Mathfs","last_synced_at":"2025-04-25T13:31:25.063Z","repository":{"id":39702475,"uuid":"262585395","full_name":"FreyaHolmer/Mathfs","owner":"FreyaHolmer","description":"Expanded Math Functionality for Unity","archived":false,"fork":false,"pushed_at":"2025-04-01T22:25:40.000Z","size":565,"stargazers_count":2562,"open_issues_count":1,"forks_count":182,"subscribers_count":77,"default_branch":"master","last_synced_at":"2025-04-11T00:02:21.814Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","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/FreyaHolmer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"FreyaHolmer","patreon":"acegikmo"}},"created_at":"2020-05-09T14:12:23.000Z","updated_at":"2025-04-07T06:31:01.000Z","dependencies_parsed_at":"2025-04-10T22:30:55.319Z","dependency_job_id":"c394f083-fe1a-4861-bee2-7b6a2f8befaa","html_url":"https://github.com/FreyaHolmer/Mathfs","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FreyaHolmer%2FMathfs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FreyaHolmer%2FMathfs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FreyaHolmer%2FMathfs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FreyaHolmer%2FMathfs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FreyaHolmer","download_url":"https://codeload.github.com/FreyaHolmer/Mathfs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250824943,"owners_count":21493368,"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":[],"created_at":"2024-08-02T05:02:16.183Z","updated_at":"2025-04-25T13:31:24.074Z","avatar_url":"https://github.com/FreyaHolmer.png","language":"C#","funding_links":["https://github.com/sponsors/FreyaHolmer","https://patreon.com/acegikmo"],"categories":["Open Source Repositories","Game-Math","C\\#"],"sub_categories":["Utilities"],"readme":"# Mathfs\nFreya's expanded math functionality for Unity!\n- This is primarily a way for me to share the math functionality I write and use in my own personal projects\n- I will recklessly edit and adapt things without too much thought into backwards compatibility\n- Minimum Unity version is currently 2021.2 due to using newer C# version features. It may be possible to auto-downgrade through your IDE if necessary\n- Commits with version tags should be relatively stable. Other commits may not be\n\n## Installation instructions\n\nThere are several ways to install this library into your project:\n\n- **Plain install**\n   - Clone or [download](https://github.com/FreyaHolmer/Mathfs/archive/refs/heads/master.zip) this repository and put it somewhere in the Assets folder of your Unity project\n- **Unity Package Manager (UPM)**:\n   - Add either of the the following lines to *Packages/manifest.json*:\n   - `\"com.acegikmo.mathfs\": \"https://github.com/FreyaHolmer/Mathfs.git#0.1.0\",` if you want to target a specific version (recommended)\n   - `\"com.acegikmo.mathfs\": \"https://github.com/FreyaHolmer/Mathfs.git\",` if you want to pull the latest commit (potentially unstable)\n   - More information about UPM and git [here](https://docs.unity3d.com/Manual/upm-git.html)\n- **[OpenUPM](https://openupm.com)**\n   - After installing [openupm-cli](https://github.com/openupm/openupm-cli), run the following command:\n   - `openupm add com.acegikmo.mathfs`\n\nAfter installation you will be able to access the library in scripts by including the namespace `using Freya`\n\n## Features\n - 2D Intersection tests between all combinations of:\n   - Ray\n   - LineSegment\n   - Line\n   - Circle\n - Curves \u0026 Splines\n   - Bézier (Quadratic, Cubic \u0026 Generalized)\n   - Hermite\n   - Catmull-Rom\n   - B-Spline (Uniform Cubic \u0026 Generalized Non-Uniform)\n   - NURBS (Non-Unifrom Rational B-Spline)\n   - Trajectory (Cubic \u0026 Generalized)\n - Trajectory math\n   - GetDisplacement (point in trajectory), given gravity, angle, speed \u0026 time\n   - GetLaunchSpeed, given gravity, angle \u0026 lateral distance\n   - GetLaunchAngles, given gravity, speed \u0026 lateral distance\n   - GetMaxRange, given gravity \u0026 speed\n   - GetHeightPotential, given gravity, current height and speed\n   - GetSpeedFromHeightPotential, given gravity, current height and height potential\n - Triangle math\n   - Area / SignedArea, given three points or base and height\n   - Contains check, given three triangle vertices and a point to test by\n   - Right-angle trig functions to calculate Opposite/Adjacent/Hypotenuse/Angle\n   - Incenter / Centroid\n   - Incircle / Circumcircle\n   - SmallestAngle\n - Polygon math\n   - Area / SignedArea\n   - IsClockwise\n   - WindingNumber\n   - Contains\n - Circle math\n   - FromTwoPoints (get smallest circle passing through both points)\n   - FromThreePoints (get unique circle passing through three points)\n   - RadiusToArea / AreaToRadius\n   - AreaToCircumference / CircumferenceToArea\n   - RadiusToCircumference / CircumferenceToRadius\n - 2D Angle helpers (AngToDir, DirToAng...)\n - 2D Vector extension methods (Rotate90CCW/CW, Rotate, RotateAround...)\n - Quadratic \u0026 Linear Root finders\n - Remap functions\n - Constants (Tau, Pi, Golden Ratio, e, sqrt2)\n - Vector extension methods (WithMagnitude, ClampMagnitude(min,max)...)\n - Expanded basic math operations to vectors (Clamp, Round, Abs...)\n - Color extensions (WithAlpha, MultiplyRGB...)\n - Smoothing functions (Smooth01, SmoothCos01...)\n - Triangle Math helpers (SignedArea, Circumcenter, Incircle...)\n - Circle Math helpers (Area, Circumference...)\n - All functions use radians\n - And more!\n\n## Changes\nMathfs.cs **does not fully match Unity's Mathf.cs**, I've made a few changes:\n - All angles are in radians, no methods use degrees\n - Lerp and InverseLerp:\n   - Unclamped by default\n   - LerpClamped/InverseLerpClamped are now the special case functions/exceptions\n   - Uses the more numerically stable evaluation\n - Smoothstep is removed in favor of the more explicit:\n   - LerpSmooth (which is how it was implemented) and\n   - InverseLerpSmooth (which is how it is implemented everywhere but Unity's Mathf.cs)\n - Min/Max functions with arbitrary inputs/array input will throw on empty instead of returning 0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFreyaHolmer%2FMathfs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FFreyaHolmer%2FMathfs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFreyaHolmer%2FMathfs/lists"}