How to use the math.gl.equals function in math

To help you get started, we’ve selected a few math examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github uber / deck.gl / test / modules / core / effects / lighting / sunlight.spec.js View on Github external
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.');
  });
github uber / deck.gl / test / modules / core / effects / lighting / sunlight.spec.js View on Github external
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.');
  });
github uber / deck.gl / src / core / viewports / viewport.js View on Github external
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?
  }
github uber / deck.gl / test / modules / core / utils / math-utils.spec.js View on Github external
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();
});
github uber / luma.gl / test / modules / core / utils / histopyramid.spec.js View on Github external
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');
  });

math

Mathematical Functions

Unknown
Latest version published 13 years ago

Package Health Score

39 / 100
Full package analysis