{"id":18685714,"url":"https://github.com/matthewgeorgy/mmath","last_synced_at":"2026-04-25T11:35:35.408Z","repository":{"id":213975105,"uuid":"331791037","full_name":"matthewgeorgy/mmath","owner":"matthewgeorgy","description":"C99 header-only vector math library","archived":false,"fork":false,"pushed_at":"2021-05-04T18:31:11.000Z","size":139,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-03T21:21:39.558Z","etag":null,"topics":["c","c99","glsl","opengl"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/matthewgeorgy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2021-01-22T00:19:54.000Z","updated_at":"2025-01-18T04:29:35.000Z","dependencies_parsed_at":"2023-12-24T20:39:59.000Z","dependency_job_id":null,"html_url":"https://github.com/matthewgeorgy/mmath","commit_stats":null,"previous_names":["matthewgeorgy/mmath"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/matthewgeorgy/mmath","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matthewgeorgy%2Fmmath","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matthewgeorgy%2Fmmath/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matthewgeorgy%2Fmmath/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matthewgeorgy%2Fmmath/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/matthewgeorgy","download_url":"https://codeload.github.com/matthewgeorgy/mmath/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matthewgeorgy%2Fmmath/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32261117,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-25T09:15:33.318Z","status":"ssl_error","status_checked_at":"2026-04-25T09:15:31.997Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["c","c99","glsl","opengl"],"created_at":"2024-11-07T10:23:53.442Z","updated_at":"2026-04-25T11:35:35.372Z","avatar_url":"https://github.com/matthewgeorgy.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MMath\n\nLast updated: Apr 11th, 2021\n\nAs mentioned in the description, this is my highly-optimized, C99 header-only/matrix vector math library, fully compatible with OpenGL / GLSL 3+ (I personally use 4.5).\n\nReasons for writing my own library (when plenty out there already exist):\n\n## 1. Support for C\nGLM is one of the more commonly used libraries (which I will focus on here), is also header-only, but it is only compatible with C++. One of the most confusing things I faced when first learning OpenGL was the fact that I never saw a single tutorial/guide/reference that covered OpenGL using C, despite the fact that it's a C API. The reason for this, as I have come to learn, is that almost all of these resources use GLM as their vector/matrix math library, which immediately forces you to use C++ whether you like it or not. It also doesn't help that GLM, reasonably so, uses C++ features, ie, classes, namespaces, operator/function overloading, and templates (ESPECIALLY templates - I'll get to these later). As a result, you really don't have a choice when it comes to what language to use if you choose to use GLM. Now of course you can always just opt to write C-style C++, but the limitation on what language you have to use is still present.\n\n## 2. Size / simplicity\nGLM is a VERY big library (over 400 files!) because it supports numerous mathematical constructs, such as complex numbers and quaternions. Many of these constructs aren't required in my case, so it's a waste of space having to include them all in my project. Furthermore, many of these files are either i) empty  ii) filled with blank declarations  iii) just more #includes. This results in increased compile times, a polluted console output, and an unneccessary amount of bloat in my projects, which I'd like to minimize as much as possible. By comparison, my library is only ~500 lines and only supports what __I__ need (vec2, vec3, mat4, utility funcs). Yes, of course this makes it a less powerful library, but the key point here is simplicity and ease of expansion when necessary. I also don't really like the syntax/naming schemes that GLM uses for its functions.\n\n## 3. GLM's complexity and template abuse\nThese two points tie together so I will address them as one. Simply put, GLM has some of the ugliest C++ template abuse I've ever seen, and I encourage anyone reading this to open up the GLM source code and just have a read through the code. This makes the code unnecessarily bloated in my case since I only using floats for my vectors/matrices. That being said, there are cases in which it's more ideal/efficient to have vectors/matrices that use ints instead of floats, but I have yet to ever find myself in such a position.\n\nNow, there is another library called CGLM that addresses many of the issues I've outlined above: it's written in C, it's much smaller and conciser, and it's easier to understand. However, there is still additional, unneccessary overhead in my opinion, and it supports a lot more mathematical constructs that I don't need. But regardless of these improvements that CGLM makes, it will NEVER change the final reason I have below.\n\n## 4. Do it yourself\nI like writing C code, and I find enjoyment in developing my own libraries/tools/utilities etc. Writing my own library means I have full control over it, so I can optimize it as I see fit, and I can design it the way I want (ie. syntax/naming conventions that I mentioned earlier). It's been a very rewarding experience so far and it's taught me a lot about how to develop my own libraries. It's also nice having something that I can easily integrate into future projects, as well as the understanding all the code that I write/use.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatthewgeorgy%2Fmmath","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatthewgeorgy%2Fmmath","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatthewgeorgy%2Fmmath/lists"}