Skip to content

Commit

Permalink
fix off-by-0.5 in convex hull calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
adroitwhiz committed Nov 28, 2019
1 parent 1eb066c commit 12ddbd1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/RenderWebGL.js
Original file line number Diff line number Diff line change
Expand Up @@ -1807,12 +1807,12 @@ class RenderWebGL extends EventEmitter {
let rr = -1;
let Q;
for (let y = 0; y < height; y++) {
_pixelPos[1] = y / height;
_pixelPos[1] = (y + 0.5) / height;
// Scan from left to right, looking for a touchable spot in the
// skin.
let x = 0;
for (; x < width; x++) {
_pixelPos[0] = x / width;
_pixelPos[0] = (x + 0.5) / width;
EffectTransform.transformPoint(drawable, _pixelPos, _effectPos);
if (drawable.skin.isTouchingLinear(_effectPos)) {
Q = [x, y];
Expand Down Expand Up @@ -1842,7 +1842,7 @@ class RenderWebGL extends EventEmitter {
// Scan from right to left, looking for a touchable spot in the
// skin.
for (x = width - 1; x >= 0; x--) {
_pixelPos[0] = x / width;
_pixelPos[0] = (x + 0.5) / width;
EffectTransform.transformPoint(drawable, _pixelPos, _effectPos);
if (drawable.skin.isTouchingLinear(_effectPos)) {
Q = [x, y];
Expand Down

0 comments on commit 12ddbd1

Please sign in to comment.