Delaunay points are a list of NaN
ChadHartman opened this issue · comments
Greetings; I'm trying to learn about this library and am seeing strange behavior. Regardless of the ranges and number of values passed, the resulting Delaunay object's points are NaN. Steps to reproduce:
$ node -v
v14.4.0
$ npm -version
6.14.5
./package.json
:
{
"type": "module",
"dependencies": {
"d3-delaunay": "^5.3.0"
}
}
./index.js
:
import d3 from "./node_modules/d3-delaunay/dist/d3-delaunay.min.js";
let coords = Float64Array.of(69, 82, 203, 18, 320, 116, 359, 88, 302, 37, 16, 108, 255, 207, 199, 76, 340, 142, 311, 139, 381, 37, 340, 82);
console.log(d3.Delaunay.from(coords).points);
$ node index.js
outputs:
Float64Array(48) [
NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN,
NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN,
NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN,
NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN,
NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN,
NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN
]
Delaunay.from takes an array [[x1, y1], [x2, y2], …]
.
Use new Delaunay if you want to pass in an array [x1, y1, x2, y2, …]
.