{"id":13440303,"url":"https://github.com/felselva/mathc","last_synced_at":"2026-01-14T21:01:42.125Z","repository":{"id":39633057,"uuid":"105834107","full_name":"felselva/mathc","owner":"felselva","description":"Pure C math library for 2D and 3D programming","archived":false,"fork":false,"pushed_at":"2024-02-21T07:08:35.000Z","size":267,"stargazers_count":752,"open_issues_count":18,"forks_count":57,"subscribers_count":26,"default_branch":"master","last_synced_at":"2025-12-14T18:56:11.047Z","etag":null,"topics":["2d","3d","c","graphics","math","matrices","minimal","quaternions","vectors"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"zlib","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/felselva.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":"2017-10-05T00:36:54.000Z","updated_at":"2025-12-10T13:36:05.000Z","dependencies_parsed_at":"2024-06-19T03:08:17.065Z","dependency_job_id":null,"html_url":"https://github.com/felselva/mathc","commit_stats":null,"previous_names":["ferreiradaselva/mathc"],"tags_count":19,"template":false,"template_full_name":null,"purl":"pkg:github/felselva/mathc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felselva%2Fmathc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felselva%2Fmathc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felselva%2Fmathc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felselva%2Fmathc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/felselva","download_url":"https://codeload.github.com/felselva/mathc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felselva%2Fmathc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28434517,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T18:57:19.464Z","status":"ssl_error","status_checked_at":"2026-01-14T18:52:48.501Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["2d","3d","c","graphics","math","matrices","minimal","quaternions","vectors"],"created_at":"2024-07-31T03:01:21.525Z","updated_at":"2026-01-14T21:01:41.894Z","avatar_url":"https://github.com/felselva.png","language":"C","readme":"# MATHC\n\nMATHC is a simple math library for 2D and 3D programming.\n\n## Features\n\n- Vectors (2D, 3D and 4D) (integer type and floating-point type)\n- Quaternions\n- Matrices (2×2, 3×3, and 4×4)\n- Easing functions\n\n## Contributions and Development\n\nYou can help with the development of MATHC testing the library, sending in-scope math functions, reporting errors and giving feedback.\n\nI work little on the library nowadays, but I am always open to suggestions and contributions.\n\n## Versioning\n\nStarting on version 2, the development of MATHC uses calendar versioning, with a tag `YYYY.MM.DD.MICRO` for each stable release. If a release breaks backward compatibility, then it is mentioned in the release notes.\n\n## Configuring\n\nMATHC can be configured using these preprocessors:\n\n- `MATHC_NO_INT`: disable implementations using `mint_t`.\n- `MATHC_USE_INT8`: define `mint_t` as `int8_t`.\n- `MATHC_USE_INT16`: define `mint_t` as `int16_t`.\n- `MATHC_USE_INT32`: define `mint_t` as `int32_t`. This is the default.\n- `MATHC_USE_INT64`: define `mint_t` as `int64_t`.\n- `MATHC_INT_TYPE`: set a custom type for `mint_t`.\n- `MATHC_NO_FLOATING_POINT`: disable implementations using `mfloat_t`.\n- `MATHC_USE_SINGLE_FLOATING_POINT`: define `mfloat_t` as `float`. This is the default.\n- `MATHC_USE_DOUBLE_FLOATING_POINT`: define `mfloat_t` as `double`.\n- `MATHC_FLOATING_POINT_TYPE`: set a custom type for `mfloat_t`.\n- `MATHC_USE_UNIONS`: define anonymous unions inside structures.\n- `MATHC_NO_POINTER_STRUCT_FUNCTIONS`: don't define the functions that take pointer to structures.\n- `MATHC_NO_STRUCT_FUNCTIONS`: don't define the functions that take structures as value.\n- `MATHC_NO_EASING_FUNCTIONS`: don't define the easing functions.\n\nYou can define these preprocessors using the compiler's option `-D` or using the compiler's option `-include` to include a configuration header with the configuration preprocessors inside it.\n\nExample of a configuration header that makes `mint_t` a `int16_t`, `mfloat_t` a `GLfloat` and uses the standard math functions with double floating-point precision:\n\n```c\n#include \u003cgl.h\u003e\n\n#define MATHC_USE_INT16\n#define MATHC_FLOATING_POINT_TYPE GLfloat\n#define MATHC_USE_DOUBLE_FLOATING_POINT\n```\n\n## Types\n\nBy default, vectors, quaternions and matrices can be declared as arrays of `mint_t`, arrays of `mfloat_t`, or structures.\n\n## Functions\n\nBy default, MATHC has functions that take as argument arrays of `mint_t`, arrays of `mfloat_t`, structures as value, or pointer to structures. Functions that take structure as value have a prefix `s`. Functions that take structure pointer have a prefix `ps`.\n\n## Easing Functions\n\nThe easing functions are an implementation of the functions presented in [easings.net](http://easings.net/), useful particularly for animations.\n\nEasing functions take a value inside the range `0.0-1.0` and usually will return a value inside that same range.\n\n## Usage\n\nCreating a \"look at\" view matrix, useful for 3D programming:\n\n```c\nmfloat_t position[VEC3_SIZE];\nmfloat_t target[VEC3_SIZE];\nmfloat_t up[VEC3_SIZE];\nmfloat_t view[MAT4_SIZE];\n\nmat4_look_at(view,\n\tvec3(position, 0.0, 0.0, 10.0),\n\tvec3(target, 0.0, 0.0, 0.0),\n\tvec3(up, 0.0, 1.0, 0.0));\n```\n\nCreating a perspective projection matrix:\n\n```c\nmfloat_t perspective[MAT4_SIZE];\n\nmat4_perspective(perspective, to_radians(60.0), 1.0, 0.1, 100.0);\n```\n\nCreating a model matrix:\n\n```c\nmfloat_t position[VEC3_SIZE];\nmfloat_t scaling[VEC3_SIZE];\nstruct {\n\tmfloat_t position[MAT4_SIZE];\n\tmfloat_t rotation[MAT4_SIZE];\n\tmfloat_t scaling[MAT4_SIZE];\n\tmfloat_t model[MAT4_SIZE];\n} matrices;\n\n/* Position */\nmat4_identity(matrices.position);\nmat4_translation(matrices.position,\n\tvec3(position, 0.0, 0.0, 0.0));\n\n/* Rotation */\nmat4_identity(matrices.rotation);\nmat4_rotation_x(matrices.rotation, to_radians(30.0));\n\n/* Scaling */\nmat4_identity(matrices.scaling);\nmat4_translation(matrices.scaling,\n\tvec3(scaling, 1.0, 1.0, 1.0));\n\n/* Model matrix */\nmat4_multiply(matrices.model, matrices.scaling, matrices.rotation);\nmat4_multiply(matrices.model, matrices.position, matrices.model);\n```\n\n## License\n\nCopyright © 2018 Felipe Ferreira da Silva\n\nThis software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.\n\nPermission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:\n\n1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.\n2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.\n3. This notice may not be removed or altered from any source distribution.\n","funding_links":[],"categories":["C"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffelselva%2Fmathc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffelselva%2Fmathc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffelselva%2Fmathc/lists"}