Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delaunay points are a list of NaN #116

Closed
ChadHartman opened this issue Oct 21, 2020 · 1 comment
Closed

Delaunay points are a list of NaN #116

ChadHartman opened this issue Oct 21, 2020 · 1 comment

Comments

@ChadHartman
Copy link

ChadHartman commented Oct 21, 2020

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
]
@mbostock
Copy link
Member

Delaunay.from takes an array [[x1, y1], [x2, y2], …].

Use new Delaunay if you want to pass in an array [x1, y1, x2, y2, …].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants