Thanks for having a look at it and for the refactoring!
Yeah, it seems it fails depending on the set of points used. But I have found it is not related to having a point at (0, 0)
. So, for example…
This works:
var points = [
new THREE.Vector2(-20, 0),
new THREE.Vector2(-20, -20),
new THREE.Vector2(20, -20),
new THREE.Vector2(20, 40),
new THREE.Vector2(-10, 40),
new THREE.Vector2(-10.0, 0.0),
new THREE.Vector2(-20, 0),
];
This does not:
var points = [
new THREE.Vector2(-20, 0),
new THREE.Vector2(-20, -20),
new THREE.Vector2(10, -20),
new THREE.Vector2(10, 40),
new THREE.Vector2(-10, 40),
new THREE.Vector2(-10.0, 0.0),
new THREE.Vector2(-20, 0),
];
Notice the change in points 2
and 3
, where I only change their x
attribute from 20
to 10
.