Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
n1ckfg committed Jan 31, 2022
1 parent 75b3afd commit 3dd485c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 29 deletions.
24 changes: 10 additions & 14 deletions js/telidon/build/naplps-encoder.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,21 +293,17 @@ class NapEncoder {
pointsToEncode.push(_points[0]);
} else {
let nv = _points[i];
let p = pointsToEncode[0];
let p = pointsToEncode[pointsToEncode.length-1];

let x = 0;
if (nv.x < p.x) {
x = Math.abs(nv.x - p.x) - 1.0;
} else if (nv.x > p.x) {
x = Math.abs(nv.x - p.x);
}

let y = 0;
if (nv.y < p.y) {
y = Math.abs(nv.y - p.y) - 1.0;
} else if (nv.y > p.y) {
y = Math.abs(nv.y - p.y);
}
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
let x = Math.abs(nv.x) - Math.abs(p.x);
if (nv.x < p.x) x *= -1;
if (nv.x > 0) x = Math.abs(x) - 1.0;

let y = Math.abs(nv.y) - Math.abs(p.y);
if (nv.y < p.y) y *= -1;
if (nv.y > 0) y = Math.abs(y) - 1.0;
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

let newPoint = new Vector2(x, y);
pointsToEncode.push(newPoint);
Expand Down
23 changes: 8 additions & 15 deletions js/telidon/naplps.js
Original file line number Diff line number Diff line change
Expand Up @@ -1604,21 +1604,14 @@ class NapEncoder {
pointsToEncode.push(_points[0]);
} else {
let nv = _points[i];
let p = pointsToEncode[0];

let x = 0;
if (nv.x < p.x) {
x = Math.abs(nv.x - p.x) - 1.0;
} else if (nv.x > p.x) {
x = Math.abs(nv.x - p.x);
}

let y = 0;
if (nv.y < p.y) {
y = Math.abs(nv.y - p.y) - 1.0;
} else if (nv.y > p.y) {
y = Math.abs(nv.y - p.y);
}
let p = pointsToEncode[pointsToEncode.length-1];

let x = Math.abs(nv.x) - Math.abs(p.x);
if (nv.x < p.x) x *= -1;
if (nv.x > 0) x = Math.abs(x) - 1.0;
let y = Math.abs(nv.y) - Math.abs(p.y);
if (nv.y < p.y) y *= -1;
if (nv.y > 0) y = Math.abs(y) - 1.0;

let newPoint = new Vector2(x, y);
pointsToEncode.push(newPoint);
Expand Down

0 comments on commit 3dd485c

Please sign in to comment.