{"id":18919285,"url":"https://github.com/shanebdavis/gui_geometry","last_synced_at":"2026-03-12T16:30:21.649Z","repository":{"id":6540781,"uuid":"7782179","full_name":"shanebdavis/gui_geometry","owner":"shanebdavis","description":"2D geometry Ruby Gem designe for use in graphical user interfaces","archived":false,"fork":false,"pushed_at":"2019-10-26T01:04:37.000Z","size":162,"stargazers_count":0,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-31T23:16:04.564Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","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/shanebdavis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-01-23T19:40:05.000Z","updated_at":"2013-11-08T23:29:14.000Z","dependencies_parsed_at":"2022-09-13T11:52:00.223Z","dependency_job_id":null,"html_url":"https://github.com/shanebdavis/gui_geometry","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shanebdavis%2Fgui_geometry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shanebdavis%2Fgui_geometry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shanebdavis%2Fgui_geometry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shanebdavis%2Fgui_geometry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shanebdavis","download_url":"https://codeload.github.com/shanebdavis/gui_geometry/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239914939,"owners_count":19717760,"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-11-08T10:36:49.633Z","updated_at":"2026-03-12T16:30:21.576Z","avatar_url":"https://github.com/shanebdavis.png","language":"Ruby","readme":"# GuiGeo\n\nThere are a few good geometry gems already available for Ruby (ruby-geometry and geometry), but I need one which is focused on the needs of creating 2D graphical user interfaces.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n    gem 'gui_geometry'\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install gui_geometry\n\n## Usage\n\nPoints are represented by X and Y coordinates:\n\nRectangles consist of two point objects. One specifies the location of the rectangle - it's top-left corner. The other specifies its size in terms of width then height.\n\n``` ruby\nrequire \"gui_geometry\"\ninclude GuiGeo\n\n# create point x == y == 0\npoint\n# =\u003e point(0,0)\n\n# create a point x=3, y=4\nmy_point = point(3,4)\n# =\u003e point(3,4)\n\n[my_point.x, my_point.y]\n# =\u003e [3, 4]\n\n# create a rectangle - x, y, w, h form\nrect(4,5,100,80)\n# =\u003e rect(4,5,100,80)\n\n# create rectangle - location, size form\nmy_rect = rect point(4,5), point(100,80)\n# =\u003e rect(4,5,100,80)\n\n# create rectangle - size form (location defaults to 0,0\nrect point(30,50)\n# =\u003e rect(0,0,30,50)\n\n# get loc and size:\n[my_rect.loc, my_rect.size]\n# =\u003e [point(4,5), point(100,80)]\n\n# get x, y, width and height\n[my_rect.x, my_rect.y, my_rect.w, my_rect.h]\n# =\u003e [4, 5, 100, 80]\n\n# get the 4 corners:\n[my_rect.tl, my_rect.tr, my_rect.bl, my_rect.br]\n# =\u003e [point(4,5), point(104,5), point(4,85), point(104,85)]\n\n```\n\nTo get access to min, max, bound, and minmax:\n\n```\ninclude GuiGeo::Tools\n\nmin(4,5)\n# =\u003e 4\n\nmax(4,5)\n# =\u003e 5\n\nminmax(4,5)\n# =\u003e [4,5]\n\nbound(5,4,10)\n# =\u003e 5\n```\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshanebdavis%2Fgui_geometry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshanebdavis%2Fgui_geometry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshanebdavis%2Fgui_geometry/lists"}