How to use the gl-vec3.scale function in gl-vec3

To help you get started, we’ve selected a few gl-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 rolyatmax / sketches / sketches / 2019.10.27-21.36.51.js View on Github external
function subdivideMeshes (mesh) {
    const planeNormal = rand.onSphere(1)
    const planePt = rand.insideSphere(5)
    const [mesh1, mesh2] = clipMeshWithPlane(mesh, planeNormal, planePt)
    const offset1 = vec3.scale([], planeNormal, settings.offset)
    const offset2 = vec3.scale([], planeNormal, -settings.offset)
    // const rotation = mat4.fromRotation([], rand.range(0, Math.PI * 0.5), planeNormal)
    return [
      mesh1.map(points => points.map(pt => vec3.add([], pt, offset1))),
      mesh2.map(points => points.map(pt => vec3.add([], pt, offset2)))
      // mesh1.map(points => points.map(pt => vec3.transformMat4([], pt, rotation))),
      // mesh2
    ]
  }
github rolyatmax / sketches / sketches / 2019.10.28-18.39.01.js View on Github external
function subdivideMeshes (mesh) {
    const planeNormal = rand.onSphere(1)
    const planePt = rand.insideSphere(5)
    const [mesh1, mesh2] = clipMeshWithPlane(mesh, planeNormal, planePt)
    const offset1 = vec3.scale([], planeNormal, settings.offset)
    const offset2 = vec3.scale([], planeNormal, -settings.offset)
    // const rotation = mat4.fromRotation([], rand.range(0, Math.PI * 0.5), planeNormal)
    return [
      mesh1.map(points => points.map(pt => vec3.add([], pt, offset1))),
      mesh2.map(points => points.map(pt => vec3.add([], pt, offset2)))
      // mesh1.map(points => points.map(pt => vec3.transformMat4([], pt, rotation))),
      // mesh2
    ]
  }
github rolyatmax / sketches / sketches / 2019.11.04-19.05.27.js View on Github external
function subdivideMeshes (mesh) {
    const planeNormal = rand.onSphere(1)
    const planePt = rand.insideSphere(5)
    const [mesh1, mesh2] = clipMeshWithPlane(mesh, planeNormal, planePt)
    const offset1 = vec3.scale([], planeNormal, settings.offset)
    const offset2 = vec3.scale([], planeNormal, -settings.offset)
    mesh1.positions = mesh1.positions.map(pt => vec3.add([], pt, offset1))
    mesh2.positions = mesh2.positions.map(pt => vec3.add([], pt, offset2))
    return [mesh1, mesh2]
  }
github rolyatmax / sketches / sketches / 2019.10.30-10.49.33.js View on Github external
function subdivideMeshes (mesh) {
    const planeNormal = rand.onSphere(1)
    const planePt = rand.insideSphere(5)
    const [mesh1, mesh2] = clipMeshWithPlane(mesh, planeNormal, planePt)
    const offset1 = vec3.scale([], planeNormal, settings.offset)
    const offset2 = vec3.scale([], planeNormal, -settings.offset)
    return [
      mesh1.map(points => points.map(pt => vec3.add([], pt, offset1))),
      mesh2.map(points => points.map(pt => vec3.add([], pt, offset2)))
    ]
  }
github rolyatmax / sketches / sketches / 2019.10.28-19.57.21.js View on Github external
function subdivideMeshes (mesh) {
    const planeNormal = rand.onSphere(1)
    const planePt = rand.insideSphere(5)
    const [mesh1, mesh2] = clipMeshWithPlane(mesh, planeNormal, planePt)
    const offset1 = vec3.scale([], planeNormal, settings.offset)
    const offset2 = vec3.scale([], planeNormal, -settings.offset)
    return [
      mesh1.map(points => points.map(pt => vec3.add([], pt, offset1))),
      mesh2.map(points => points.map(pt => vec3.add([], pt, offset2)))
    ]
  }

gl-vec3

gl-matrix's vec3, split into smaller pieces

Zlib
Latest version published 6 years ago

Package Health Score

54 / 100
Full package analysis