{"id":13731554,"url":"https://github.com/jpreiss/cmath3d","last_synced_at":"2026-01-29T07:46:58.231Z","repository":{"id":145905976,"uuid":"64078853","full_name":"jpreiss/cmath3d","owner":"jpreiss","description":"3d math library for C. Vectors, 3x3 matrices, quaternions, polytopes.","archived":false,"fork":false,"pushed_at":"2021-07-20T03:56:50.000Z","size":145,"stargazers_count":26,"open_issues_count":2,"forks_count":2,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-11-14T22:35:25.945Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/jpreiss.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-07-24T18:08:27.000Z","updated_at":"2024-10-24T12:22:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"17c53439-a5ed-4688-8433-2c5990879bb1","html_url":"https://github.com/jpreiss/cmath3d","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpreiss%2Fcmath3d","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpreiss%2Fcmath3d/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpreiss%2Fcmath3d/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpreiss%2Fcmath3d/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jpreiss","download_url":"https://codeload.github.com/jpreiss/cmath3d/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253001094,"owners_count":21838470,"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-03T02:01:32.709Z","updated_at":"2026-01-29T07:46:58.216Z","avatar_url":"https://github.com/jpreiss.png","language":"C","readme":"![](https://github.com/jpreiss/cmath3d/workflows/test/badge.svg)\n[![](https://img.shields.io/codecov/c/github/jpreiss/cmath3d)](https://codecov.io/gh/jpreiss/cmath3d/branch/master)\n\n# cmath3d\n3d math library for C. Vectors, 3x3 matrices, quaternions. 32-bit floats.\n\n## motivation\nThis library is intended for embedded projects where C++ is not used.\nIn the author's opinion, C++'s feature set enables dramatically\nmore readable 3d math code. However, many embedded projects stick with C\nby necessity or preference. The goal of this project is to create the\nbest possible programmer experience within the constraints of C syntax.\n**If cmath3d is missing something you need, feature requests are encouraged.**\n\n## design choices\nUnlike many other C libraries of this type, `cmath3d` passes arguments\nand returns results by value instead of by pointer and pointer-to-output.\nThis choice has several motivations:\n\n- avoids the need to name non-meaningful intermediate results for the sake of taking their address\n- enables nested expressions\n- reduces bugs by allowing more variables to be declared `const`\n- gives the optimizing compiler complete knowledge about function semantics,\n  theoretically enabling better optimizations \n  (see [Chandler Carruth's talk](https://www.youtube.com/watch?v=eR34r7HOU14))\n\nAlthough Carruth's talk implies that using these functions with inline, \nheader-only definitions -- thus hiding no code from the compiler \nin external object files -- will enable as good or better optimizations\nthan a pass-by-pointer version, in practice this library seems to consume\nmore stack memory than it should.\nI am currently researching ways to fix this problem, since I believe\na SSA compiler with the ability to destructure structs should produce\noptimal code from this library.\n\n## note for users\nIf you use `cmath3d` in your project,\nI would very much appreciate it if you leave a comment in [#2](https://github.com/jpreiss/cmath3d/issues/2).\n","funding_links":[],"categories":["Maths"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpreiss%2Fcmath3d","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjpreiss%2Fcmath3d","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpreiss%2Fcmath3d/lists"}