Replace all occurences of Math.sqrt(2) with Math.SQRT2

This commit is contained in:
Jürg Lehni 2016-12-29 09:36:54 +01:00
parent 27a2757542
commit 97abd80bab
4 changed files with 5 additions and 5 deletions

View file

@ -128,7 +128,7 @@
sum += data[j];
}
var avg = sum / (255 * (end - start));
bands[i] = Math.sqrt(avg / Math.sqrt(2));
bands[i] = Math.sqrt(avg / Math.SQRT2);
}
return bands;
}

View file

@ -126,7 +126,7 @@
var upVector = vector.normalize(lengthSize).rotate(45 * sign);
var downVector = upVector.rotate(-90 * sign);
var lengthVector = vector.normalize(
vector.length / 2 - lengthSize * Math.sqrt(2));
vector.length / 2 - lengthSize * Math.SQRT2);
var line = new Path();
line.add(from + awayVector);
line.lineBy(upVector);

View file

@ -540,7 +540,7 @@ test('hit-testing fills with tolerance', function() {
});
var tolerance = 10;
var point = path.bounds.bottomRight.add(tolerance / Math.sqrt(2));
var point = path.bounds.bottomRight.add(tolerance / Math.SQRT2);
equals(function() {
var result = paper.project.hitTest(point, {

View file

@ -88,12 +88,12 @@ test('set angle', function() {
test('set angle & length', function() {
var point1 = new Point();
point1.length = Math.sqrt(2);
point1.length = Math.SQRT2;
point1.angle = -45;
var point2 = new Point();
point2.angle = -45;
point2.length = Math.sqrt(2);
point2.length = Math.SQRT2;
equals(point2, point1);
});