Git Product home page Git Product logo

delaunay's Introduction

Delaunay

Build Status Coverage Status License

delaunay is a Lua module for delaunay triangulation of a convex polygon.

##Download

###Git

git clone http://github.com/Yonaba/delaunay.git

###Archive

###LuaRocks

luarocks install delaunay

###MoonRocks

luarocks install --server=http://rocks.moonscript.org/manifests/Yonaba delaunay

##Installation Copy the file delaunay.lua inside your project folder, call it with require function. It will return the Delaunay module, keeping safe the global environment.

##Usage

The module provides 3 classes:

  • Point
  • Edge
  • Triangle

It also provides a single function named triangulate. This function accepts a variable list (vararg ...) of instances of class Point. Assuming those points are the vertices of a convex polygon, it returns a table of instances of the class Triangle forming a Delaunay triangulation of the given polygon.

A basic code example:

local Delaunay = require 'Delaunay'
local Point    = Delaunay.Point

-- Creating 10 random points
local points = {}
for i = 1, 10 do
  points[i] = Point(math.random() * 100, math.random() * 100)
end

-- Triangulating de convex polygon made by those points
local triangles = Delaunay.triangulate(unpack(points))

-- Printing the results
for i, triangle in ipairs(triangles) do
  print(triangle)
end

See the documentation for more details.

##Testing ###Specification

This repository include unit tests. You can run them using Telescope with the following command from the root foolder:

lua tsc -f specs/*

###Performance

You can run the random performance tests included with the following command from the root folder:

lua performance/bench.lua

##License This work is under MIT-LICENSE.
Copyright (c) 2013 Roland Yonaba

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Bitdeli Badge

delaunay's People

Contributors

yonaba avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.