@@ -31,7 +31,12 @@ function jitter(x, y, r) {
31
31
return [ x + Math . sin ( x + y ) * r , y + Math . cos ( x - y ) * r ] ;
32
32
}
33
33
34
- export default Object . assign ( class Delaunay {
34
+ export default class Delaunay {
35
+ static from ( points , fx = pointX , fy = pointY , that ) {
36
+ return new Delaunay ( "length" in points
37
+ ? flatArray ( points , fx , fy , that )
38
+ : Float64Array . from ( flatIterable ( points , fx , fy , that ) ) ) ;
39
+ }
35
40
constructor ( points ) {
36
41
this . _delaunator = new Delaunator ( points ) ;
37
42
this . inedges = new Int32Array ( points . length / 2 ) ;
@@ -216,13 +221,7 @@ export default Object.assign(class Delaunay {
216
221
this . renderTriangle ( i , polygon ) ;
217
222
return polygon . value ( ) ;
218
223
}
219
- } , {
220
- from ( points , fx = pointX , fy = pointY , that ) {
221
- return new Delaunay ( "length" in points
222
- ? flatArray ( points , fx , fy , that )
223
- : Float64Array . from ( flatIterable ( points , fx , fy , that ) ) ) ;
224
- }
225
- } ) ;
224
+ }
226
225
227
226
function flatArray ( points , fx , fy , that ) {
228
227
const n = points . length ;
0 commit comments