{"id":18728759,"url":"https://github.com/rubyonworld/geometry","last_synced_at":"2025-11-12T05:30:18.071Z","repository":{"id":174007918,"uuid":"542157025","full_name":"RubyOnWorld/geometry","owner":"RubyOnWorld","description":"Classes and methods for the handling of all of the basic geometry that you learned in high school (and then forgot).","archived":false,"fork":false,"pushed_at":"2022-09-27T17:10:00.000Z","size":317,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-12-28T14:26:19.384Z","etag":null,"topics":["class","geometry","method"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RubyOnWorld.png","metadata":{"files":{"readme":"README.markdown","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-09-27T15:27:07.000Z","updated_at":"2022-09-27T17:57:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"66c81e63-2aeb-44ad-ad79-755f75edefbe","html_url":"https://github.com/RubyOnWorld/geometry","commit_stats":null,"previous_names":["rubyonworld/geometry"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RubyOnWorld%2Fgeometry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RubyOnWorld%2Fgeometry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RubyOnWorld%2Fgeometry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RubyOnWorld%2Fgeometry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RubyOnWorld","download_url":"https://codeload.github.com/RubyOnWorld/geometry/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239599039,"owners_count":19665911,"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":["class","geometry","method"],"created_at":"2024-11-07T14:24:16.459Z","updated_at":"2025-11-12T05:30:18.018Z","avatar_url":"https://github.com/RubyOnWorld.png","language":"Ruby","readme":"Geometry for Ruby\n=================\n\n[![Build Status](https://travis-ci.org/bfoz/geometry.png)](https://travis-ci.org/bfoz/geometry)\n[![Gem Version](https://badge.fury.io/rb/geometry.svg)](http://badge.fury.io/rb/geometry)\n\nClasses and methods for the handling of all of the basic geometry that you \nlearned in high school (and then forgot).\n\nThe classes in this libary are based on the Vector class provided by the Ruby \nstandard library. Geometric primitives are generally assumed to lie in 2D space,\nbut aren't necessarily restricted to it. Please let me know if you find cases \nthat don't work in higher dimensions and I'll do my best to fix them.\n\nLicense\n-------\n\nCopyright 2012-2016 Brandon Fosdick \u003cbfoz@bfoz.net\u003e and released under the BSD license.\n\nPrimitives\n----------\n\n- Point\n- Size\n- Line\n- Edge\n- [Annulus](http://en.wikipedia.org/wiki/Annulus_(mathematics))\n- [Arc](http://en.wikipedia.org/wiki/Arc_(geometry)), Circle\n- [Bézier Curves](http://en.wikipedia.org/wiki/Bézier_curve)\n- Rectangle, Square\n- Path, [Polyline](http://en.wikipedia.org/wiki/Polyline), [Polygon](http://en.wikipedia.org/wiki/Polygon), [RegularPolygon](http://en.wikipedia.org/wiki/Regular_polygon)\n- Transformation\n- [Triangle](http://en.wikipedia.org/wiki/Triangle)\n- [Obround](http://en.wiktionary.org/wiki/obround)\n\nExamples\n--------\n\n### Point\n```ruby\npoint = Geometry::Point[3,4]    # 2D Point at coordinate 3, 4\n\n# Copy constructors\npoint2 = Geometry::Point[point]\npoint2 = Geometry::Point[Vector[5,6]]\n\n# Accessors\npoint.x\npoint.y\npoint[2]\t# Same as point.z\n\n# Zero\nPointZero.new   # A Point full of zeros of unspecified length\nPoint.zero      # Another way to do the same thing\nPoint.zero(3)   # =\u003e Point[0,0,0]\n```\n\n### Line\n```ruby\n# Two-point constructors\nline = Geometry::Line[[0,0], [10,10]]\nline = Geometry::Line[Geometry::Point[0,0], Geometry::Point[10,10]]\nline = Geometry::Line[Vector[0,0], Vector[10,10]]\n\n# Slope-intercept constructors\nGeometry::Line[Rational(3,4), 5]\t# Slope = 3/4, Intercept = 5\nGeometry::Line[0.75, 5]\n\n# Point-slope constructors\nGeometry::Line(Geometry::Point[0,0], 0.75)\nGeometry::Line(Vector[0,0], Rational(3,4))\n\n# Special constructors (2D only)\nGeometry::Line.horizontal(y=0)\nGeometry::Line.vertical(x=0)\n```\n\n### Rectangle\n```ruby\n# A Rectangle made from two corner points\nGeometry::Rectangle.new [1,2], [2,3]\nGeometry::Rectangle.new from:[1,2], to:[2,3]\n\nGeometry::Rectangle.new center:[1,2], size:[1,1]\t# Using a center point and a size\nGeometry::Rectangle.new origin:[1,2], size:[1,1]\t# Using an origin point and a size\n\n# A Rectangle with its origin at [0, 0] and a size of [10, 20]\nGeometry::Rectangle.new size: [10, 20]\nGeometry::Rectangle.new size: Size[10, 20]\nGeometry::Rectangle.new width: 10, height: 20\n```\n\n### Circle\n```ruby\n# A circle at Point[1,2] with a radius of 3\ncircle = Geometry::Circle.new center:[1,2], radius:3\n```\n\n### Polygon\n```ruby\n# A polygon that looks a lot like a square\npolygon = Geometry::Polygon.new [0,0], [1,0], [1,1], [0,1]\n```\n### Regular Polygon\n```ruby\n# Everyone loves a good hexagon\nhexagon = Geometry::RegularPolygon.new 6, :diameter =\u003e 3\n```\n\n### Zeros and Ones\n```ruby\n# For when you know you need a zero, but you don't know how big it should be\nzero = Point.zero       # Returns a Point of indeterminate length that always compares equal to zero\n\n# Oh, you wanted ones instead? No problem.\nones = Point.one        # =\u003e Point[1,1,1...1]\n\n# Looking for something more exotic that a mere 1?\niso = Point.iso(5)      # =\u003e Point[5,5,5...5]\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frubyonworld%2Fgeometry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frubyonworld%2Fgeometry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frubyonworld%2Fgeometry/lists"}