A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/mikolalysenko/incremental-delaunay below:

mikolalysenko/incremental-delaunay: Constructs a Delaunay triangulation for a collection of points

Incremental Delaunay triangulation data structure.

Warning This module has problems in >3D. For those cases you should use delaunay-triangulate instead.

var createTriangulation = require("incremental-delaunay")

//Create a 2D triangulation with some points
var triangulation = createTriangulation(2, [
  [0,1],
  [1,0],
  [1,1]
])

//Insert some random point
triangulation.insert([1, 2])

//Get all points in the triangulation
console.log("points=", triangulation.points)

//Get all cells in the triangulation
console.log("cells=", triangulation.cells)

//Locate a triangle containing a point
console.log("located triangle=", triangulation.locate([0.5, 0.5]))

Example output:

points= [ [ -1e+30, -1e+30 ],
  [ 1e+30, -1e+30 ],
  [ 0, 1e+30 ],
  [ 0, 1 ],
  [ 1, 0 ],
  [ 1, 1 ],
  [ 1, 2 ] ]


cells= [ [ 5, 6, 3 ],
  [ 3, 6, 2 ],
  [ 6, 1, 2 ],
  [ 5, 1, 6 ],
  [ 4, 5, 3 ],
  [ 4, 1, 5 ],
  [ 3, 0, 4 ],
  [ 0, 1, 4 ],
  [ 0, 3, 2 ] ]


located triangle= [ 3, 0, 4 ]
var createTriangulation = require("incremental-delaunay")
var triangulation = createTriangulation(dimension, points)

Creates a triangulation

Returns A DelaunayTriangulation object

An array of all cells in the triangulation

An array of all points in the triangulation

triangulation.insert(point)

Adds point to the triangulation

triangulation.locate(point)

Returns the simplex containing point

(c) 2013-2014 Mikola Lysenko. MIT License


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4