{"id":24529750,"url":"https://github.com/learosema/ella-math","last_synced_at":"2025-04-14T17:36:10.872Z","repository":{"id":38204883,"uuid":"262161218","full_name":"learosema/ella-math","owner":"learosema","description":"Basic Geometry and Linear Algebra library","archived":false,"fork":false,"pushed_at":"2023-02-14T22:55:01.000Z","size":1291,"stargazers_count":14,"open_issues_count":2,"forks_count":3,"subscribers_count":0,"default_branch":"main","last_synced_at":"2024-04-28T18:43:14.478Z","etag":null,"topics":["geometry","linear-algebra-library"],"latest_commit_sha":null,"homepage":"https://learosema.github.io/ella-math/","language":"TypeScript","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/learosema.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":"2020-05-07T21:21:37.000Z","updated_at":"2024-01-24T00:36:02.000Z","dependencies_parsed_at":"2024-11-16T23:16:48.165Z","dependency_job_id":"aeaf07d6-3ac1-4bce-9d3f-4a242c5859a9","html_url":"https://github.com/learosema/ella-math","commit_stats":{"total_commits":87,"total_committers":6,"mean_commits":14.5,"dds":"0.10344827586206895","last_synced_commit":"5d005d13a17e1ee6827e44657dccc7c5a4995b10"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/learosema%2Fella-math","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/learosema%2Fella-math/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/learosema%2Fella-math/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/learosema%2Fella-math/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/learosema","download_url":"https://codeload.github.com/learosema/ella-math/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235082228,"owners_count":18932920,"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":["geometry","linear-algebra-library"],"created_at":"2025-01-22T07:52:25.263Z","updated_at":"2025-01-22T07:52:26.955Z","avatar_url":"https://github.com/learosema.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ella-math\n\nA dependency-free Geometry and linear algebra library that provides basic vector and matrix calculus operations, written in TypeScript.\n\n## Features\n\nFeatures:\n\n- vector addition, subtraction, scalar multiplication, dot product, cross product\n- calculate vector length\n- normalize vector\n- matrix multiplication, determinant, inverse implementations for mat2, mat3, mat4\n- translation and projection matrices (perspective and orthogonal projection)\n- matrix vector multiplication\n- basic geometry shapes\n\n## Install and usage\n\nYou can either import ella via NPM or directly use it via script tag.\n\n### NPM:\n\nFirst, run: `npm i ella-math`\n\n```js\nimport { Vec, Mat, Mat4 } from 'ella-math';\n\nconst a = new Vec(1, 2, 3);\nconst b = new Vec(2, 3, 4);\n\nconsole.log('a + b = ', a.add(b));\nconsole.log('a dot b = ', a.dot(b));\nconsole.log('a cross b = ', a.cross(b));\n\n// Define a matrix\n// heads up: it's the other way round as you would write it down on paper\n\n// prettier-ignore\nconst m = new Mat([\n  1, 2, 3, // column 1\n  4, 5, 6, // column 2\n  7, 8, 9, // column 3\n]);\n\nconst mDet = m.determinant(); // 0\nconst mInv = m.inverse();\nconsole.assert(\n  mInv.isFinite() === false,\n  'As the determinant of m is 0, there is no inverse of m.'\n);\n\nconst mA = Mat4.identity();\n// create a 4x4 translation matrix\nconst mB = Mat4.translation(-1, -2, -3);\n// create a 4x4 scaling matrix\nconst mC = Mat4.scaling(2, 4, 6);\n// matrix multiplication\nconst mD = mA.mul(mB);\nconsole.assert(mD.equals(mB), 'mA * mB should equal mB');\nconst mE = mD.mul(mC);\n// matrix division is like multiplication with its inverse\nconst mF = mE.div(mC);\n\nconsole.assert(mF.isFinite(), 'mF should be finite.');\nconsole.assert(mF.equals(mD), 'mF should be equal to mD');\n\n// the equality check may sometimes fail in JS due\n// to floating point arithmetics (.1+.2 !== .3 issue)\n// roughlyEquals checks with a tolerance of 1e-14\nconsole.assert(mF.roughlyEquals(mD), 'mF should be roughly equal to mD');\n```\n\n### Directly in the browser\n\nAdd this script tag: `\u003cscript src=\"https://unpkg.com/ella-math@latest/dist/ella.umd.js\"\u003e\u003c/script\u003e`\n\n```js\nconst { Vec, Mat } = Ella;\n```\n\n### Demos\n\n- [Ella 01 - rendering a sphere wireframe in an SVG path](https://codepen.io/terabaud/pen/MWazXyd)\n- [Ella 02 - rendering a sphere in WebGL](https://codepen.io/terabaud/pen/wvMQQyr)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flearosema%2Fella-math","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flearosema%2Fella-math","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flearosema%2Fella-math/lists"}