{"id":21870918,"url":"https://github.com/stregasgate/gamemath","last_synced_at":"2025-04-14T23:55:27.398Z","repository":{"id":49825797,"uuid":"352482530","full_name":"STREGAsGate/GameMath","owner":"STREGAsGate","description":"GameMath provides common types, related functions, and operators used for interactive realtime simulations (games).","archived":false,"fork":false,"pushed_at":"2023-05-21T23:08:39.000Z","size":366,"stargazers_count":53,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-14T23:55:05.252Z","etag":null,"topics":["gamedev"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/STREGAsGate.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","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},"funding":{"github":["STREGAsGate"],"patreon":"STREGAsGate","open_collective":null,"ko_fi":"STREGAsGate","tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2021-03-29T01:36:26.000Z","updated_at":"2025-02-05T14:57:41.000Z","dependencies_parsed_at":"2024-11-28T07:15:10.260Z","dependency_job_id":null,"html_url":"https://github.com/STREGAsGate/GameMath","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/STREGAsGate%2FGameMath","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/STREGAsGate%2FGameMath/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/STREGAsGate%2FGameMath/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/STREGAsGate%2FGameMath/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/STREGAsGate","download_url":"https://codeload.github.com/STREGAsGate/GameMath/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248981261,"owners_count":21193144,"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":["gamedev"],"created_at":"2024-11-28T06:12:57.735Z","updated_at":"2025-04-14T23:55:27.365Z","avatar_url":"https://github.com/STREGAsGate.png","language":"Swift","funding_links":["https://github.com/sponsors/STREGAsGate","https://patreon.com/STREGAsGate","https://ko-fi.com/STREGAsGate","https://www.patreon.com/STREGAsGate"],"categories":[],"sub_categories":[],"readme":"# GameMath \n[![Windows](https://github.com/STREGAsGate/GameMath/actions/workflows/Windows.yml/badge.svg)](https://github.com/STREGAsGate/GameMath/actions/workflows/Windows.yml) \n[![macOS](https://github.com/STREGAsGate/GameMath/actions/workflows/macOS.yml/badge.svg)](https://github.com/STREGAsGate/GameMath/actions/workflows/macOS.yml) \n[![Linux](https://github.com/STREGAsGate/GameMath/actions/workflows/Linux.yml/badge.svg)](https://github.com/STREGAsGate/GameMath/actions/workflows/Linux.yml) \n[![HTML5](https://github.com/STREGAsGate/GameMath/actions/workflows/SwiftWasm.yml/badge.svg)](https://github.com/STREGAsGate/GameMath/actions/workflows/SwiftWasm.yml)\n\nGameMath provides common types, related functions, and operators commonly used for interactive realtime simulations (games).\nYou can use this library to create simple games, or use it as a cornerstone for a more complex engine like [GateEngine](https://github.com/STREGAsGate/GateEngine).\n\n## Swift 100% \nGameMath uses protocols and generics to promote clear type intention. Vector types as an example have many variations including `Position3`, `Direction3`, and `Size3` that all conform to`Vector3`, a protocol that provides common functionality to these types.\n\nOperators such as multiplication, division, addition, and subtraction, can be used across types so long as they use the same generic constraint. The type returned will be the logical result of the operation, usually the left side.\n```swift\n//Success\nlet pos: Position3 = Position3(0, 1, 0) * Size3(1, 1, 1)\n\n//Error: Size3 cannot be converted to Position3\nlet pos: Position3 = Size3(1, 1, 1) * Position3(0, 1, 0) \n```\n\n## Easy To Understand\nGameMath is intended to make doing gamming math easier for everyone. An example is interpolation.\n\nThe functions `lerp()` and `slerp()` are commonly seen in game libraries for linear interpolation. Without advanced knowledge of these functions it's difficult to reason about them and know what they do.\nGameMath attempts to improve on this issue by introducing a common syntax for interpolation for all types across the package.\n```swift\nlet halfway = source.interpolated(to: destination, .linear(0.5))\n```\nThis syntax will be expanded with new interpolation methods like easeIn and easeOut in the future.\n\n## Coordinate Space\nGameMath uses a *Y Up*, *-Z forward*, coordinate system for 3D and *Y Up*, *X Right* for 2D.\n\nMatrix types are assumed to always be *\"left handed\"*. Use the `transposedArray` and `transposedSIMD` properties when sending data to Metal, Vulkan, OpenGL, and the `array` and `simd` properties when sending data to DirectX.\n\n# Cross Platform\nGameMath is tested to work on Windows 10, macOS, Ubuntu, iOS, tvOS, and HTML5.\nOther platforms should also work.\n\n# Support Gate Engine!\nThis package is seperated for you to enjoy, but it's built for and used by [GateEngine](https://github.com/STREGAsGate/GateEngine).\nIf you appreciate this project, and want it to continue, then please consider putting some dollars into it.\n\u003c/br\u003e\nEvery little bit helps! Support With: [GitHub](https://github.com/sponsors/STREGAsGate), [Ko-fi](https://ko-fi.com/STREGAsGate), [Pateron](https://www.patreon.com/STREGAsGate)\n\n## Community \u0026 Followables\n[![Discord](https://img.shields.io/discord/641809158051725322?label=Hang%20Out\u0026logo=Discord\u0026style=social)](https://discord.gg/5JdRJhD)\n[![Twitter](https://img.shields.io/twitter/follow/stregasgate?style=social)](https://twitter.com/stregasgate)\n[![YouTube](https://img.shields.io/youtube/channel/subscribers/UCBXFkK2B4w9856wBJfCGufg?label=Subscribe\u0026style=social)](https://youtube.com/stregasgate)\n[![Reddit](https://img.shields.io/reddit/subreddit-subscribers/stregasgate?style=social)](https://www.reddit.com/r/stregasgate/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstregasgate%2Fgamemath","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstregasgate%2Fgamemath","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstregasgate%2Fgamemath/lists"}