{"id":16099017,"url":"https://github.com/hellerve/geometry","last_synced_at":"2025-04-05T22:43:51.759Z","repository":{"id":79626259,"uuid":"60281971","full_name":"hellerve/geometry","owner":"hellerve","description":"Basic types and functions for geometry in zepto","archived":false,"fork":false,"pushed_at":"2016-06-03T10:35:12.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-12T05:12:14.046Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hellerve.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":"2016-06-02T16:59:19.000Z","updated_at":"2023-09-08T17:11:04.000Z","dependencies_parsed_at":"2023-05-13T21:31:00.821Z","dependency_job_id":null,"html_url":"https://github.com/hellerve/geometry","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/hellerve%2Fgeometry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellerve%2Fgeometry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellerve%2Fgeometry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellerve%2Fgeometry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hellerve","download_url":"https://codeload.github.com/hellerve/geometry/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247411193,"owners_count":20934650,"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-09T18:25:25.848Z","updated_at":"2025-04-05T22:43:51.732Z","avatar_url":"https://github.com/hellerve.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# geometry\n\nA minimal geometry library for and in zepto.\nSupports 2D and 3D points and vectors.\n\n## Installation\n```\nzeps install hellerve/geometry\n```\n\n## Usage\n\nThe module includes an admittedly small but tested\ninterface to the datatypes `point2d`, `point3d`, `vector2d`\nand `vector3d`. They all implement the stringify and\ncollec protocols to interface nicely with existing\ncollections.\n\n```clojure\n(load \"geometry/geometry\")\n(import-all \"geometry\")\n; The constructor of 2D points\n(geometry:point2d 1 2)\n\n; The constructor of 3D points\n(geometry:point3d 1 2 3)\n\n; The constructor of 2D vectors\n(geometry:vector2d 1 2)\n\n; The constructor of 3D vectors\n(geometry:vector3d 1 2 3)\n\n; An interface for adding/substracting multiple two-dimensional elements\n; The type will be coerced to match the first argument\n(geometry:2d+ (geometry:vector2d 1 2) (geometry:point2d 1 2)) ; will return a vector\n(geometry:2d- (geometry:point2d 1 2) (geometry:vector2d 1 2)) ; will return a point\n\n; Of course we can do the same to three-dimensional elements\n(geometry:3d+ (geometry:vector3d 1 2 3) (geometry:point3d 1 2 3)) ; will return a vector\n(geometry:3d- (geometry:point3d 1 2 3) (geometry:vector3d 1 2 3)) ; will return a point\n\n; We can switch between those types, either generically or typesafely\n(define geometry:vector2d-\u003epoint2d (import \"geometry:vector2d-\u003epoint2d\"))\n(define geometry:vector3d-\u003epoint3d (import \"geometry:vector3d-\u003epoint3d\"))\n(define geometry:vector-\u003epoint (import \"geometry:vector-\u003epoint\"))\n\n; The origin could be handy sometimes;\n; it is just a meaningful definition for a point with all coordinates set to 0\ngeometry:ORIGIN2D\ngeometry:ORIGIN3D\n\n; dot- and crossproduct exist also\n(geometry:dot (geometry:vector3d 1 3 -5) (geometry:vector3d 4 -2 -1)) ; =\u003e 3\n\n(geometry:cross (geometry:vector3d 1 2 3) (geometry:vector3d 4 5 6)) ; =\u003e vector with contents (-3 6 -3)\n```\n\nOptionally, all of these types also support the ord protocol, which enables\nus to sort them by euclidean distance from the respective origins. All you need\nto do to enable this is loading \"geometry/ord\" after requiring (or loading and\nimporting) \"geometry/geometry\".\n\n\u003chr/\u003e\n\nHave fun!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhellerve%2Fgeometry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhellerve%2Fgeometry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhellerve%2Fgeometry/lists"}