Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
TEST_CASES.forEach(testCase => {
const {azimuth, altitude} = getSolarPosition(testCase.timestamp, LATITUDE, LONGITUDE);
// azimuth is measured from south to west, azimuth + 180 is converting to north to east
const azimuthInDegree = 180 + (azimuth * 180) / Math.PI;
const altitudeInDegree = (altitude * 180) / Math.PI;
console.log(azimuthInDegree, testCase.azimuth, altitudeInDegree, testCase.altitude);
t.ok(equals(azimuthInDegree, testCase.azimuth), 'Azimuth angle should match.');
t.ok(equals(altitudeInDegree, testCase.altitude), 'Altitude angle should match.');
});
TEST_CASES.forEach(testCase => {
const {azimuth, altitude} = getSolarPosition(testCase.timestamp, LATITUDE, LONGITUDE);
// azimuth is measured from south to west, azimuth + 180 is converting to north to east
const azimuthInDegree = 180 + (azimuth * 180) / Math.PI;
const altitudeInDegree = (altitude * 180) / Math.PI;
console.log(azimuthInDegree, testCase.azimuth, altitudeInDegree, testCase.altitude);
t.ok(equals(azimuthInDegree, testCase.azimuth), 'Azimuth angle should match.');
t.ok(equals(altitudeInDegree, testCase.altitude), 'Altitude angle should match.');
});
equals(viewport) {
if (!(viewport instanceof Viewport)) {
return false;
}
return (
viewport.width === this.width &&
viewport.height === this.height &&
equals(viewport.projectionMatrix, this.projectionMatrix) &&
equals(viewport.viewMatrix, this.viewMatrix)
);
// TODO - check distance scales?
}
test('toDoublePrecisionArray', t => {
const array = Array.from({length: 10}, (d, i) => i + Math.PI);
let array64 = toDoublePrecisionArray(array, {size: 2});
t.ok(array64 instanceof Float32Array, 'returns correct type');
t.is(array64.length, 20, 'returns correct length');
t.ok(equals(fromDoublePrecisionArray(array64, 2), array), 'array reconstructs ok');
array64 = toDoublePrecisionArray(array, {size: 2, startIndex: 4, endIndex: 8});
t.ok(array64 instanceof Float32Array, 'returns correct type');
t.is(array64.length, 8, 'returns correct length');
t.ok(equals(fromDoublePrecisionArray(array64, 2), array.slice(4, 8)), 'array reconstructs ok');
t.end();
});
TEST_CASES.forEach(testCase => {
const {size} = testCase;
const expected = getExpected(size);
const elementCount = size[0]*size[1];
transform.update({elementCount});
transform.run({
uniforms: {
size
}
});
const outData = transform.getBuffer('pixelIndices').getData().slice(0, expected.length);
t.ok(equals(expected, outData), 'pixelIndices should match');
});