How to use gl-matrix-vec3 - 2 common examples

To help you get started, we’ve selected a few gl-matrix-vec3 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 martinRenou / Odysis / js / lib / src / BlockUtils / PlugIns / IsoSurfaceUtils.js View on Github external
interDatas[dataIndex].push(interpolate(
                inputDataArray[i1], d1,
                inputDataArray[i2], d2)
              );
            });
          }
        }
      }

      // Create triangles where data is equal to this.value
      v1 = [interPoints[0], interPoints[1], interPoints[2]];
      v2 = [interPoints[3], interPoints[4], interPoints[5]];
      v3 = [interPoints[6], interPoints[7], interPoints[8]];

      normal = [];
      vec3.cross(
        normal,
        [v2[0]-v1[0], v2[1]-v1[1], v2[2]-v1[2]],
        [v3[0]-v2[0], v3[1]-v2[1], v3[2]-v2[2]]
      );

      // Create new triangles
      if (vec3.dot(Geometry.normalNonUnitV(
          [0, 0, 0], v1, v2, v3), normal) < 0.0) {
        // Create first triangle
        surfaceCoordArray.push(
          v1[0], v1[1], v1[2],
          v2[0], v2[1], v2[2],
          v3[0], v3[1], v3[2]
        );

        interDatas.forEach((interData, dataIndex) => {
github martinRenou / Odysis / js / lib / src / BlockUtils / PlugIns / IsoSurfaceUtils.js View on Github external
}

      // Create triangles where data is equal to this.value
      v1 = [interPoints[0], interPoints[1], interPoints[2]];
      v2 = [interPoints[3], interPoints[4], interPoints[5]];
      v3 = [interPoints[6], interPoints[7], interPoints[8]];

      normal = [];
      vec3.cross(
        normal,
        [v2[0]-v1[0], v2[1]-v1[1], v2[2]-v1[2]],
        [v3[0]-v2[0], v3[1]-v2[1], v3[2]-v2[2]]
      );

      // Create new triangles
      if (vec3.dot(Geometry.normalNonUnitV(
          [0, 0, 0], v1, v2, v3), normal) < 0.0) {
        // Create first triangle
        surfaceCoordArray.push(
          v1[0], v1[1], v1[2],
          v2[0], v2[1], v2[2],
          v3[0], v3[1], v3[2]
        );

        interDatas.forEach((interData, dataIndex) => {
          surfaceDataArrays[dataIndex].push(interData[0]);
          surfaceDataArrays[dataIndex].push(interData[1]);
          surfaceDataArrays[dataIndex].push(interData[2]);
        });

        // If we have 4 points (4*3 coordinates, so 2 triangles)
        if (interPoints.length === 12) {

gl-matrix-vec3

Standalone Vector3 component of gl-matrix

MIT
Latest version published 11 years ago

Package Health Score

60 / 100
Full package analysis

Popular gl-matrix-vec3 functions

Similar packages