mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2024-12-29 09:22:22 -05:00
Replace all occurences of Math.sqrt(2) with Math.SQRT2
This commit is contained in:
parent
27a2757542
commit
97abd80bab
4 changed files with 5 additions and 5 deletions
|
@ -128,7 +128,7 @@
|
||||||
sum += data[j];
|
sum += data[j];
|
||||||
}
|
}
|
||||||
var avg = sum / (255 * (end - start));
|
var avg = sum / (255 * (end - start));
|
||||||
bands[i] = Math.sqrt(avg / Math.sqrt(2));
|
bands[i] = Math.sqrt(avg / Math.SQRT2);
|
||||||
}
|
}
|
||||||
return bands;
|
return bands;
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,7 +126,7 @@
|
||||||
var upVector = vector.normalize(lengthSize).rotate(45 * sign);
|
var upVector = vector.normalize(lengthSize).rotate(45 * sign);
|
||||||
var downVector = upVector.rotate(-90 * sign);
|
var downVector = upVector.rotate(-90 * sign);
|
||||||
var lengthVector = vector.normalize(
|
var lengthVector = vector.normalize(
|
||||||
vector.length / 2 - lengthSize * Math.sqrt(2));
|
vector.length / 2 - lengthSize * Math.SQRT2);
|
||||||
var line = new Path();
|
var line = new Path();
|
||||||
line.add(from + awayVector);
|
line.add(from + awayVector);
|
||||||
line.lineBy(upVector);
|
line.lineBy(upVector);
|
||||||
|
|
|
@ -540,7 +540,7 @@ test('hit-testing fills with tolerance', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
var tolerance = 10;
|
var tolerance = 10;
|
||||||
var point = path.bounds.bottomRight.add(tolerance / Math.sqrt(2));
|
var point = path.bounds.bottomRight.add(tolerance / Math.SQRT2);
|
||||||
|
|
||||||
equals(function() {
|
equals(function() {
|
||||||
var result = paper.project.hitTest(point, {
|
var result = paper.project.hitTest(point, {
|
||||||
|
|
|
@ -88,12 +88,12 @@ test('set angle', function() {
|
||||||
|
|
||||||
test('set angle & length', function() {
|
test('set angle & length', function() {
|
||||||
var point1 = new Point();
|
var point1 = new Point();
|
||||||
point1.length = Math.sqrt(2);
|
point1.length = Math.SQRT2;
|
||||||
point1.angle = -45;
|
point1.angle = -45;
|
||||||
|
|
||||||
var point2 = new Point();
|
var point2 = new Point();
|
||||||
point2.angle = -45;
|
point2.angle = -45;
|
||||||
point2.length = Math.sqrt(2);
|
point2.length = Math.SQRT2;
|
||||||
|
|
||||||
equals(point2, point1);
|
equals(point2, point1);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue