{"id":19521848,"url":"https://github.com/inochi2d/inmath","last_synced_at":"2025-02-26T00:45:56.987Z","repository":{"id":114246502,"uuid":"492283001","full_name":"Inochi2D/inmath","owner":"Inochi2D","description":"Games math library for D","archived":false,"fork":false,"pushed_at":"2024-09-11T20:48:06.000Z","size":485,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-08T14:12:05.383Z","etag":null,"topics":["dlang","math","nogc"],"latest_commit_sha":null,"homepage":"","language":"D","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"Dav1dde/gl3n","license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Inochi2D.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":"2022-05-14T17:31:11.000Z","updated_at":"2024-09-11T20:47:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"4cf99f37-fb47-4f92-99b7-b238109a8dd4","html_url":"https://github.com/Inochi2D/inmath","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Inochi2D%2Finmath","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Inochi2D%2Finmath/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Inochi2D%2Finmath/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Inochi2D%2Finmath/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Inochi2D","download_url":"https://codeload.github.com/Inochi2D/inmath/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240771907,"owners_count":19854982,"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":["dlang","math","nogc"],"created_at":"2024-11-11T00:35:25.408Z","updated_at":"2025-02-26T00:45:56.652Z","avatar_url":"https://github.com/Inochi2D.png","language":"D","funding_links":[],"categories":[],"sub_categories":[],"readme":"InMath\n====\n\nInMath, forked from gl3n, is a mathematics library for D providing math functions useful for multimedia software.\n\nInMath provides all the math you need to work with OpenGL and Metal.\n\n* Linear algebra\n    * Vectors\n    * Matrices\n        * Metal-compatible orthographic and projection matrix functions! (`perspective01`, `orthographic01`)\n    * Quaternions\n    * Rectangles\n    * AABBs\n    * Planes,\n    * Frustrums\n* Interpolation\n    * Linear interpolation (`lerp`)\n    * Spherical linear interpolation (`slerp`)\n    * Hermite interpolation\n    * Catmull rom interpolation\n    * Cubic interpolation\n* Dampening\n    * Basic distance based dampening (`dampen`)\n    * Dampened Harmonic Oscillator (`smoothDamp`)\n* Noise\n    * OpenSimplex2\n* Colors\n    * HSV\u003c-\u003eRGB conversion\n    * Hexstring to RGB(A) conversion\n    * RGBA32\u003c-\u003eRGBAF conversion\n* No unexpected side effects\n    * No unexpected casts\n    * Vector multiplication is _not_ dot product.\n    * InMath uses camelCase for the naming of things\n    * InMath simplifies parts of gl3n by removing excessive use of aliases.\n    * InMath is usable without the GC!\n\nInstallation\n============\n\nYou can use inmath in your project via the dub package database.\n\nExamples\n========\n\n```D\nvec4 v4 = vec4(1.0f, vec3(2.0f, 3.0f, 4.0f));\nvec4 v4_2 = vec4(1.0f, vec4(1.0f, 2.0f, 3.0f, 4.0f).xyz); // \"dynamic\" swizzling with opDispatch\nvec4 v4_3 = v4_2.xxyz; // opDispatch returns a static array which you can pass directly to the ctor of a vector!\n\nvec3 v3 = my_3dvec.rgb;\nvec3 foo = v4.xyzzzwzyyxw.xyz // not useful but possible!\n\nmat4 m4fv = mat4.translation(-0.5f, -0.54f, 0.42f).rotateX(PI).rotateZ(PI/2);\nglUniformMatrix4fv(location, 1, GL_TRUE, m4fv.ptr); // yes they are row major!\n\nalias Matrix!(double, 4, 4) mat4d;\nmat4d projection;\nglGetDoublev(GL_PROJECTION_MATRIX, projection.ptr);\n\nmat3 inv_view = view.rotation;\nmat3 inv_view = mat3(view);\n\nmat4 m4 = mat4(vec4(1.0f, 2.0f, 3.0f, 4.0f), 5.0f, 6.0f, 7.0f, 8.0f, vec4(...) ...); \n```\n\n```D\n    void strafeLeft(float delta) { // A\n        vec3 vcross = cross(up, forward).normalized;\n        _position = _position + vcross.dot(delta);\n    }\n\n    void strafeRight(float delta) { // D\n        vec3 vcross = cross(up, forward).normalized;\n        _position = _position - vcross.dot(delta);\n    }\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finochi2d%2Finmath","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finochi2d%2Finmath","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finochi2d%2Finmath/lists"}