{"id":13822369,"url":"https://github.com/PistonDevelopers/vecmath","last_synced_at":"2025-05-16T15:34:09.160Z","repository":{"id":18571540,"uuid":"21774300","full_name":"PistonDevelopers/vecmath","owner":"PistonDevelopers","description":"A simple and type agnostic Rust library for vector math designed for reexporting","archived":false,"fork":false,"pushed_at":"2021-04-11T09:47:16.000Z","size":130,"stargazers_count":78,"open_issues_count":3,"forks_count":14,"subscribers_count":44,"default_branch":"master","last_synced_at":"2025-04-29T03:56:14.750Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","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/PistonDevelopers.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},"funding":{"github":"bvssvni"}},"created_at":"2014-07-12T19:00:46.000Z","updated_at":"2024-09-21T09:32:17.000Z","dependencies_parsed_at":"2022-09-26T17:51:04.575Z","dependency_job_id":null,"html_url":"https://github.com/PistonDevelopers/vecmath","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/PistonDevelopers%2Fvecmath","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PistonDevelopers%2Fvecmath/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PistonDevelopers%2Fvecmath/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PistonDevelopers%2Fvecmath/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PistonDevelopers","download_url":"https://codeload.github.com/PistonDevelopers/vecmath/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254556909,"owners_count":22091016,"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-04T08:01:57.126Z","updated_at":"2025-05-16T15:34:08.896Z","avatar_url":"https://github.com/PistonDevelopers.png","language":"Rust","funding_links":["https://github.com/sponsors/bvssvni"],"categories":["Rust"],"sub_categories":[],"readme":"# vecmath [![Build Status](https://travis-ci.org/PistonDevelopers/vecmath.svg?branch=master)](https://travis-ci.org/PistonDevelopers/vecmath)\n\nA simple and type agnostic Rust library for vector math designed for reexporting\n\n[How to contribute](https://github.com/PistonDevelopers/piston/blob/master/CONTRIBUTING.md)\n\n## Motivation\n\nIt is hard to agree on the \"the best\" way of designing a linear algebra or game math library.  \nSometimes you only need a few functions, like dot or cross product and don't want to deal with traits.  \nPerhaps you know the math, but the type system gets in your way?  \nThis library is designed to be simple, generic and easy to build abstractions on top of.  \n\nIf this is not what you looking for, here are some alternatives:\n\n* Game math - [cgmath-rs](https://github.com/bjz/cgmath-rs)\n* Linear algebra + game math - [nalgebra](http://nalgebra.org/)\n\n### Goals\n\n* No traits\n* No type declarations that gives dependencies\n* Global functions only to make it easier to build on top of it\n* Fixed arrays\n* Row vs column major matrices agnostic\n* Generics\n\n### Non-Goals\n\n* Game math or linear algebra\n* Traits or module system that people can disagree on\n* Quaternions\n* Dual numbers\n* Matrix setup\n\n## Usage\n\nA good convention is to reexport the library in a `vecmath` module in your library/executable.  \nBy reexporting you can add new functions and send pull requests without breaking the code.  \nBesides, it is nicer to put custom math functions under the same name space,  \neven if those never will be added to the original vector math library.  \n\n### Edit your 'Cargo.toml' file\n\nOpen up 'Cargo.toml' in a text editor and add the following:\n\n```\n[dependencies.vecmath]\nversion = \"1.0.0\"\n```\n\n### Step 1\n\nAdd the following to 'lib.rs':\n\n```Rust\nextern crate vecmath;\n\nmod math; // Use 'pub mod' if you want it to be visible outside library.\n```\n\n### Step 2\n\nCreate a new file 'math.rs' in your 'src/' directory.\nOpen 'math.rs' in a text editor and type:\n\n```Rust\npub use vecmath::row_mat2x3_mul as multiply;\n\npub type Matrix2d = vecmath::Matrix2x3\u003cf64\u003e;\n\n// etc.\n```\n\nYou can add your own custom functions and rename the existing ones for your usage.\n\n## Naming conventions\n\nAll methods are prefixed with a short name version.  \n\nExamples:\n\n`mat3x4_` a 3x4 matrix.\n\n`mat4_` a 4x4 matrix.\n\n`vec3_` a vector with 3 components.\n\n`col_mat4x3_` the matrix is treated as a matrix with column major\n\n## Generic conventions\n\nFor simplicity, all methods should take a generic parameter with specific operations, e.g. `\u003cT: Add\u003cT, Output = T\u003e\u003e` for addition.  \nIn cases where extra methods are required, `traits::Float` should be used instead.  \nAll arguments are passed by value, so `Copy` can be added as requirement when needed.  \nInlining will remove the overhead.  \n\nThis increases readability and is good enough for the usage of this library.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPistonDevelopers%2Fvecmath","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FPistonDevelopers%2Fvecmath","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPistonDevelopers%2Fvecmath/lists"}