{"id":16856436,"url":"https://github.com/vallentin/linearalgebra","last_synced_at":"2025-03-18T11:14:16.877Z","repository":{"id":89082122,"uuid":"57344717","full_name":"vallentin/LinearAlgebra","owner":"vallentin","description":"Linear algebra library that supports vectors, matrices and quaternions","archived":false,"fork":false,"pushed_at":"2020-10-02T21:15:57.000Z","size":67,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-24T17:34:52.926Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vallentin.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-04-29T01:15:20.000Z","updated_at":"2023-09-20T17:37:54.000Z","dependencies_parsed_at":"2023-03-15T19:15:34.216Z","dependency_job_id":null,"html_url":"https://github.com/vallentin/LinearAlgebra","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/vallentin%2FLinearAlgebra","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vallentin%2FLinearAlgebra/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vallentin%2FLinearAlgebra/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vallentin%2FLinearAlgebra/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vallentin","download_url":"https://codeload.github.com/vallentin/LinearAlgebra/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244207746,"owners_count":20416109,"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-10-13T14:04:14.562Z","updated_at":"2025-03-18T11:14:16.870Z","avatar_url":"https://github.com/vallentin.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# LinearAlgebra [![Build Status][LinearAlgebraBuildStatus]][LinearAlgebraCI] ![Release][LinearAlgebraVersionBadge] ![License][LinearAlgebraLicenseBadge]\n\n[LinearAlgebra][LinearAlgebra] is a linear algebra library, which consists of:\n\n- Vectors\n  - Vector 2D (`vec2`)\n  - Vector 3D (`vec3`)\n  - Vector 4D (`vec4`)\n\n- Matrices\n  - Matrix 2D (`mat2`, `mat2x2`)\n  - Matrix 3D (`mat3`, `mat3x3`)\n  - Matrix 4D (`mat4`, `mat4x4`)\n\n- Quaternion (`quat`)\n- ~~Dual Quaternion (`dualquat`)~~\n\n\nSince [LinearAlgebra][LinearAlgebra] was built for use with computer graphics, it contains\na few helper classes for especially that:\n\n- ~~Transform~~\n- ~~Project~~ (Functionality stored in `mat4`)\n- ~~MatrixStack~~\n\n\nVarious methods are implemented such that they can be called by your liking:\n\n```cpp\nvec3 a(1.0f, 2.0f, 3.0f);\nvec3 b(4.0f, 5.0f, 6.0f);\n\nfloat dotProduct = a.dot(b);\n// vs\nfloat dotProduct = dot(a, b);\n```\n\n```cpp\nmat4 model = mat4::identity;\n// ...\n\nmat3 normalMatrix = model.inverse().transpose();\n// vs\nmat3 normalMatrix = transpose(inverse(model));\n```\n\n\nIf GCC is used then compiling [LinearAlgebra][LinearAlgebra] must include `-Wno-unknown-pragmas`,\nas various `#pragma region`'s are scattered in [LinearAlgebra][LinearAlgebra]'s implementation.\n\n\n*[LinearAlgebra][LinearAlgebra] was first created in 2013 for use with OpenGL in Java. Later\nit was rewritten for C++ and Python, where the C++ version now is the main version.*\n\n\n### Mouse to Ray\n\n```cpp\nvec2 mousePos = ...;\n\nivec4 viewport = ivec4(0, 0, viewportWidth, viewportHeight);\n\nmat4 view = ...;\nmat4 projection = ...;\n\nvec3 rayStart = mat4::unproject(vec3(mousePos, 0.0f), view, projection, viewport);\nvec3 rayEnd   = mat4::unproject(vec3(mousePos, 1.0f), view, projection, viewport);\nvec3 rayDirection = normalize(rayEnd - rayStart);\n```\n\n\n### std::cout \u0026 std::cin\n\nTo add friend functions for stream purposes,\nsimply make sure to have the `iostream` header\nincluded prior to including `linalg`.\n\n```cpp\n#include \u003ciostream\u003e\n#include \"linalg.hpp\"\n```\n\nThis now allows printing and reading `vec`, `mat` and `quat`.\n\n```cpp\nstd::cout \u003c\u003c vec4(1.0f, 2.0f, 3.0f, 4.0f) \u003c\u003c std::endl;\n\n// Prints:\n// vec4(1.0, 2.0, 3.0, 4.0)\n\nstd::cout \u003c\u003c mat3(\n\t1.0f, 2.0f, 3.0f,\n\t4.0f, 5.0f, 6.0f,\n\t7.0f, 8.0f, 9.0f) \u003c\u003c std::endl;\n\n// Prints:\n// mat3(1.0, 2.0, 3.0\n//      4.0, 5.0, 6.0,\n//      7.0, 8.0, 9.0)\n```\n\n\n## License\n\n```\nCopyright (c) 2013-2016 Christian Vallentin \u003cvallentin.source@gmail.com\u003e\n\nThis software is provided 'as-is', without any express or implied\nwarranty. In no event will the authors be held liable for any damages\narising from the use of this software.\n\nPermission is granted to anyone to use this software for any purpose,\nincluding commercial applications, and to alter it and redistribute it\nfreely, subject to the following restrictions:\n\n1. The origin of this software must not be misrepresented; you must not\n   claim that you wrote the original software. If you use this software\n   in a product, an acknowledgment in the product documentation would be\n   appreciated but is not required.\n\n2. Altered source versions must be plainly marked as such, and must not\n   be misrepresented as being the original software.\n\n3. This notice may not be removed or altered from any source\n   distribution.\n```\n\n\n[LinearAlgebra]: https://github.com/vallentin/LinearAlgebra\n[LinearAlgebraLicense]: https://github.com/vallentin/LinearAlgebra/blob/master/LICENSE\n\n[LinearAlgebraBuildStatus]: https://drone.io/github.com/vallentin/LinearAlgebra/status.png\n[LinearAlgebraCI]: https://drone.io/github.com/vallentin/LinearAlgebra/latest\n\n[LinearAlgebraVersionBadge]: https://img.shields.io/badge/release-v1.1.17-blue.svg\n[LinearAlgebraLicenseBadge]: https://img.shields.io/badge/license-%20free%20to%20use%2C%20share%2C%20modify%20and%20redistribute-blue.svg\n\n[LinearAlgebraIssueTracker]: https://github.com/vallentin/LinearAlgebra/issues\n\n\n[LinearAlgebraWiki]: https://en.wikipedia.org/wiki/Linear_algebra\n[LinearMapWiki]: https://en.wikipedia.org/wiki/Linear_map\n\n[LinearInterpolationWiki]: https://en.wikipedia.org/wiki/Linear_interpolation\n\n[GLSL]: https://www.opengl.org/documentation/glsl/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvallentin%2Flinearalgebra","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvallentin%2Flinearalgebra","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvallentin%2Flinearalgebra/lists"}