{"id":26880876,"url":"https://github.com/nickscha/geom","last_synced_at":"2025-03-31T14:50:46.138Z","repository":{"id":57721769,"uuid":"91981820","full_name":"nickscha/geom","owner":"nickscha","description":"A lightweight geometry libary with fluent API","archived":false,"fork":false,"pushed_at":"2019-04-16T19:02:17.000Z","size":137,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-02-21T14:35:52.991Z","etag":null,"topics":["geom","geometry-library","glsl","graphics","java","lwjgl","math-library"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nickscha.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}},"created_at":"2017-05-21T19:24:39.000Z","updated_at":"2024-12-28T13:25:59.000Z","dependencies_parsed_at":"2022-09-26T21:50:22.435Z","dependency_job_id":null,"html_url":"https://github.com/nickscha/geom","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickscha%2Fgeom","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickscha%2Fgeom/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickscha%2Fgeom/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickscha%2Fgeom/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nickscha","download_url":"https://codeload.github.com/nickscha/geom/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246485911,"owners_count":20785420,"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":["geom","geometry-library","glsl","graphics","java","lwjgl","math-library"],"created_at":"2025-03-31T14:50:45.552Z","updated_at":"2025-03-31T14:50:46.132Z","avatar_url":"https://github.com/nickscha.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# geom\r\n\r\n[![Maven](https://maven-badges.herokuapp.com/maven-central/com.github.nickscha/geom/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.nickscha/geom)\r\n[![javadoc](http://javadoc.io/badge/com.github.nickscha/geom.svg)](http://javadoc.io/doc/com.github.nickscha/geom)\r\n![Build Status](https://travis-ci.org/nickscha/geom.svg?branch=master)\r\n![codecov.io](https://codecov.io/github/nickscha/geom/coverage.svg?branch=master)\r\n![License](https://img.shields.io/hexpm/l/plug.svg)\r\n\r\nA lightweight geometry liberay with fluent API.\r\n\r\n## Maven\r\n```xml\r\n\u003cdependency\u003e\r\n  \u003cgroupId\u003ecom.github.nickscha\u003c/groupId\u003e\r\n  \u003cartifactId\u003egeom\u003c/artifactId\u003e\r\n  \u003cversion\u003e0.0.2\u003c/version\u003e\r\n\u003c/dependency\u003e\r\n```\r\n\r\nThe artifact is published under https://oss.sonatype.org\r\n\r\n\r\n## Supported Types\r\n\r\nClass names are aligned with GLSL names.\r\n\r\n| Type          | Components                 | Progress  |\r\n| ------------- | -------------------------: | --------- |\r\n| Vectors       | Vec1f, Vec2f, Vec3f, Vec4f | 80%       |\r\n|               | Vec1d, Vec2d, Vec3d, Vec4d | 80%       |\r\n| Matrices      |               Mat3f, Mat4f | 60%       |\r\n|               |               Mat3d, Mat4d | 60%       |\r\n| Quaternions   |                      Quatf | 40%       |\r\n|               |                      Quatd | 40%       |\r\n| Transform     |             Transf, Transd | 20%       |\r\n\r\n## Roadmap version 0.0.3\r\n\r\n* Add cascading Transform (Transf) class for translating, scaling and rotating matrices based on their parent matrices.\r\n* Enhance Javadocs\r\n\r\n## Requirements\r\n\r\n* Java 8 or later\r\n\r\n## Examples\r\n\r\nFor more examples have a look at the src/test/resources/demo directory.\r\n\r\n### MVP (Model View Projection Matrix)\r\n\r\n```java\r\nVec3f myObjectPosInScene = Vec3f.of(3, 5, -2);\r\nMat4f rotationMatrix = myObjectPosInScene.rotationMatrix();\r\nMat4f modelMatrix = Mat4f.modelMatrix(myObjectPosInScene);\r\n\r\n// The view matrix is functionally equivalent to a camera. It does the\r\n// same thing as a model matrix, but it applies the same transformations\r\n// equally to every object in the scene. Moving the whole world 5 units\r\n// towards us is the same as if we had walked 5 units forwards.\r\nMat4f viewMatrix = Mat4f.viewMatrix(myObjectPosInScene, rotationMatrix);\r\n\r\n// We shrink the model secene to the specified ratios and define that\r\n// objects nearer than one and farther than ten gets clipped out.\r\nMat4f projectionMatrix = Mat4f.projectionMatrix(90, 1024 / 860, 1, 10);\r\n\r\n// The object to render has been moved from model to view (aka world)\r\n// space to the projection matrix (rectangle as the screen)\r\nMat4f mvpMatrix = Mat4f.mvpMatrix(modelMatrix, viewMatrix, projectionMatrix);\r\n```\r\n\r\n### Look at\r\nImagine an object in your 3d scene which should look always to your camera.\r\nHere we resolve the roatation matrix for the model...\r\n\r\n```java\r\nVec3f camera = Vec3f.of(0, 5, 5);\r\nVec3f modelToLookAtCamera = Vec3f.of(7, 7, 7);\r\nMat4f.lookAtMatrix(camera, modelToLookAtCamera, Vec3f.of(0, 1, 0));\r\n```\r\n\r\n### Calculating Normals based on two vectors\r\nIn this demo we will calculate the normal vector based on two supplied vectors.\r\n```java\r\nVec3f one = Vec3f.of(1, 1, 1);\r\nVec3f two = Vec3f.of(-1, -1, -1);\r\nVec3f normalized = one.cross(two).normalize(); // Result is 0,0,0\r\n```\r\n\r\n### Swizzling types\r\nGeom provides swizzling for all types.\r\n```java\r\nVec2f res = Vec3f.of(1, 2, 1).mul(2).xy();\r\nMat4f res = Vec3f.of(6, 2, 1).scaleMatrix();\r\n```\r\n\r\n### Serialization\r\nGeom provides a general purpose serialization for all types.\r\n```java\r\nbyte[] data = Vec3f.of(1,2,3).toBytes();\r\nVec3f res = Vec3f.fromBytes(data);\r\n```\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnickscha%2Fgeom","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnickscha%2Fgeom","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnickscha%2Fgeom/lists"}