{"id":19665008,"url":"https://github.com/hendrixfan/delaunator-ruby","last_synced_at":"2025-04-28T22:31:00.799Z","repository":{"id":56844133,"uuid":"226191199","full_name":"hendrixfan/delaunator-ruby","owner":"hendrixfan","description":" Delaunay triangulation of 2D points. A Ruby Port","archived":false,"fork":false,"pushed_at":"2025-02-20T13:32:30.000Z","size":27,"stargazers_count":10,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-23T01:03:01.280Z","etag":null,"topics":["2d","delaunay","delaunay-triangulation","geometry","triangulation"],"latest_commit_sha":null,"homepage":"","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/hendrixfan.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":"2019-12-05T21:21:47.000Z","updated_at":"2025-02-20T13:32:27.000Z","dependencies_parsed_at":"2022-09-05T15:31:45.869Z","dependency_job_id":null,"html_url":"https://github.com/hendrixfan/delaunator-ruby","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/hendrixfan%2Fdelaunator-ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hendrixfan%2Fdelaunator-ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hendrixfan%2Fdelaunator-ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hendrixfan%2Fdelaunator-ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hendrixfan","download_url":"https://codeload.github.com/hendrixfan/delaunator-ruby/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251397576,"owners_count":21583034,"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":["2d","delaunay","delaunay-triangulation","geometry","triangulation"],"created_at":"2024-11-11T16:20:01.946Z","updated_at":"2025-04-28T22:31:00.491Z","avatar_url":"https://github.com/hendrixfan.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Gem Version](https://badge.fury.io/rb/delaunator.svg)](https://badge.fury.io/rb/delaunator)\n[![Build Status](https://travis-ci.com/hendrixfan/delaunator-ruby.svg?branch=master)](https://travis-ci.com/hendrixfan/delaunator-ruby)\n\n# Delaunay Triangulation\n\nThis is a port of [Mapbox's Delaunator project](https://github.com/mapbox/delaunator).\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'delaunator'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install delaunator\n\n## Usage\n\n`Delaunator.triangulate()` returns an array of triangle vertex indices (each group of three numbers forms a triangle). All triangles are directed counterclockwise.\n\n```ruby\npoints = [[382, 302], [382, 328], [382, 205], [623, 175], [382, 188], [382, 284], [623, 87], [623, 341], [141, 227]]\ntriangles = Delaunator.triangulate(points)\n# =\u003e [2, 3, 4, 2, 5, 3, 5, 7, 3, 3, 6, 4, 0, 7, 5, 1, 7, 0, 0, 8, 1, 5, 8, 0, 2, 8, 5, 4, 8, 2, 6, 8, 4]\n```\n\nYou can then use these indices to get the coordinates of each triangle:\n\n```ruby\n(0..triangles.length-1).step(3) do |i|\n    ax, ay = points[triangles[i]]\n    bx, by = points[triangles[i + 1]]\n    cx, cy = points[triangles[i + 2]]\n    # (ax, ay), (bx, by), (cx, cy) are your triangle points\n    ...\n```\nAfter implementing your own render function you can show the edges of the Delaunay triangulation:\n\n![image](https://user-images.githubusercontent.com/19203626/71546247-4c963600-2995-11ea-948f-5fec1d7982ea.png)\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/hendrixfan/delaunator-ruby.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhendrixfan%2Fdelaunator-ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhendrixfan%2Fdelaunator-ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhendrixfan%2Fdelaunator-ruby/lists"}