当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Matrix4.multiply方法代码示例

本文整理汇总了TypeScript中THREE.Matrix4.multiply方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Matrix4.multiply方法的具体用法?TypeScript Matrix4.multiply怎么用?TypeScript Matrix4.multiply使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在THREE.Matrix4的用法示例。


在下文中一共展示了Matrix4.multiply方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: rotate

  rotate (x: number, y: number) {
    const [ dx, dy ] = this._getRotateXY(x, y)

    tmpRotateXMatrix.makeRotationX(dy)
    tmpRotateYMatrix.makeRotationY(dx)
    tmpRotateXMatrix.multiply(tmpRotateYMatrix)
    this.controls.applyMatrix(tmpRotateXMatrix)
  }
开发者ID:arose,项目名称:ngl,代码行数:8,代码来源:trackball-controls.ts

示例2: getMatrix

  getMatrix () {
    const h = this.volume.header
    const matrix = new Matrix4()

    matrix.multiply(
      new Matrix4().makeTranslation(
        h.originX, h.originY, h.originZ
      )
    )

    matrix.multiply(
      new Matrix4().makeBasis(
        h.basisZ, h.basisY, h.basisX
      )
    )

    return matrix
  }
开发者ID:arose,项目名称:ngl,代码行数:18,代码来源:cube-parser.ts

示例3: getMatrix

  getMatrix () {
    const h = this.volume.header

    const basisX = [
      h.a,
      0,
      0
    ]

    const basisY = [
      h.b * Math.cos(Math.PI / 180.0 * h.gamma),
      h.b * Math.sin(Math.PI / 180.0 * h.gamma),
      0
    ]

    const basisZ = [
      h.c * Math.cos(Math.PI / 180.0 * h.beta),
      h.c * (
        Math.cos(Math.PI / 180.0 * h.alpha) -
        Math.cos(Math.PI / 180.0 * h.gamma) *
        Math.cos(Math.PI / 180.0 * h.beta)
      ) / Math.sin(Math.PI / 180.0 * h.gamma),
      0
    ]
    basisZ[ 2 ] = Math.sqrt(
      h.c * h.c * Math.sin(Math.PI / 180.0 * h.beta) *
      Math.sin(Math.PI / 180.0 * h.beta) - basisZ[ 1 ] * basisZ[ 1 ]
    )

    const basis = [ [], basisX, basisY, basisZ ]
    const nxyz = [ 0, h.NA, h.NB, h.NC ]
    const mapcrs = [ 0, 1, 2, 3 ]

    const matrix = new Matrix4()

    matrix.set(
      basis[ mapcrs[1] ][0] / nxyz[ mapcrs[1] ],
      basis[ mapcrs[2] ][0] / nxyz[ mapcrs[2] ],
      basis[ mapcrs[3] ][0] / nxyz[ mapcrs[3] ],
      0,
      basis[ mapcrs[1] ][1] / nxyz[ mapcrs[1] ],
      basis[ mapcrs[2] ][1] / nxyz[ mapcrs[2] ],
      basis[ mapcrs[3] ][1] / nxyz[ mapcrs[3] ],
      0,
      basis[ mapcrs[1] ][2] / nxyz[ mapcrs[1] ],
      basis[ mapcrs[2] ][2] / nxyz[ mapcrs[2] ],
      basis[ mapcrs[3] ][2] / nxyz[ mapcrs[3] ],
      0,
      0, 0, 0, 1
    )

    matrix.multiply(new Matrix4().makeTranslation(
      h.AMIN, h.BMIN, h.CMIN
    ))

    return matrix
  }
开发者ID:arose,项目名称:ngl,代码行数:57,代码来源:xplor-parser.ts

示例4: getMatrix

  getMatrix () {
    const h = this.volume.header
    const matrix = new Matrix4()

    matrix.multiply(
      new Matrix4().makeRotationY(degToRad(90))
    )

    matrix.multiply(
      new Matrix4().makeTranslation(
        -h.zmin, h.ymin, h.xmin
      )
    )

    matrix.multiply(
      new Matrix4().makeScale(
        -h.hz, h.hy, h.hx
      )
    )

    return matrix
  }
开发者ID:arose,项目名称:ngl,代码行数:22,代码来源:dx-parser.ts

示例5: rotateComponent

  rotateComponent (x: number, y: number) {
    if (!this.component) return

    const [ dx, dy ] = this._getRotateXY(x, y)

    tmpRotateMatrix.extractRotation(this.component.transform)
    tmpRotateMatrix.premultiply(this.viewer.rotationGroup.matrix)
    tmpRotateMatrix.getInverse(tmpRotateMatrix)
    tmpRotateVector.set(1, 0, 0)
    tmpRotateVector.applyMatrix4(tmpRotateMatrix)
    tmpRotateXMatrix.makeRotationAxis(tmpRotateVector, dy)
    tmpRotateVector.set(0, 1, 0)
    tmpRotateVector.applyMatrix4(tmpRotateMatrix)
    tmpRotateYMatrix.makeRotationAxis(tmpRotateVector, dx)
    tmpRotateXMatrix.multiply(tmpRotateYMatrix)
    tmpRotateQuaternion.setFromRotationMatrix(tmpRotateXMatrix)
    this.component.quaternion.premultiply(tmpRotateQuaternion)
    this.component.updateMatrix()
  }
开发者ID:arose,项目名称:ngl,代码行数:19,代码来源:trackball-controls.ts

示例6: getMatrix

  getMatrix () {
    const h = this.volume.header

    const basisX = [
      h.xlen,
      0,
      0
    ]

    const basisY = [
      h.ylen * Math.cos(Math.PI / 180.0 * h.gamma),
      h.ylen * Math.sin(Math.PI / 180.0 * h.gamma),
      0
    ]

    const basisZ = [
      h.zlen * Math.cos(Math.PI / 180.0 * h.beta),
      h.zlen * (
        Math.cos(Math.PI / 180.0 * h.alpha) -
        Math.cos(Math.PI / 180.0 * h.gamma) *
        Math.cos(Math.PI / 180.0 * h.beta)
      ) / Math.sin(Math.PI / 180.0 * h.gamma),
      0
    ]
    basisZ[ 2 ] = Math.sqrt(
      h.zlen * h.zlen * Math.sin(Math.PI / 180.0 * h.beta) *
      Math.sin(Math.PI / 180.0 * h.beta) - basisZ[ 1 ] * basisZ[ 1 ]
    )

    const basis = [ [], basisX, basisY, basisZ ]
    const nxyz = [ 0, h.MX, h.MY, h.MZ ]
    const mapcrs = [ 0, h.MAPC, h.MAPR, h.MAPS ]

    const matrix = new Matrix4()

    matrix.set(
      basis[ mapcrs[1] ][0] / nxyz[ mapcrs[1] ],
      basis[ mapcrs[2] ][0] / nxyz[ mapcrs[2] ],
      basis[ mapcrs[3] ][0] / nxyz[ mapcrs[3] ],
      0,
      basis[ mapcrs[1] ][1] / nxyz[ mapcrs[1] ],
      basis[ mapcrs[2] ][1] / nxyz[ mapcrs[2] ],
      basis[ mapcrs[3] ][1] / nxyz[ mapcrs[3] ],
      0,
      basis[ mapcrs[1] ][2] / nxyz[ mapcrs[1] ],
      basis[ mapcrs[2] ][2] / nxyz[ mapcrs[2] ],
      basis[ mapcrs[3] ][2] / nxyz[ mapcrs[3] ],
      0,
      0, 0, 0, 1
    )

    matrix.setPosition(new Vector3(
      h.originX, h.originY, h.originZ
    ))

    matrix.multiply(new Matrix4().makeTranslation(
      h.NXSTART, h.NYSTART, h.NZSTART
    ))

    return matrix
  }
开发者ID:arose,项目名称:ngl,代码行数:61,代码来源:mrc-parser.ts

示例7: getMatrix

  getMatrix () {
    const h: Dsn6Header = this.volume.header

    const basisX = [
      h.xlen as number,
      0,
      0
    ]

    const basisY = [
      h.ylen * Math.cos(Math.PI / 180.0 * h.gamma),
      h.ylen * Math.sin(Math.PI / 180.0 * h.gamma),
      0
    ]

    const basisZ = [
      h.zlen * Math.cos(Math.PI / 180.0 * h.beta),
      h.zlen * (
        Math.cos(Math.PI / 180.0 * h.alpha) -
        Math.cos(Math.PI / 180.0 * h.gamma) *
        Math.cos(Math.PI / 180.0 * h.beta)
      ) / Math.sin(Math.PI / 180.0 * h.gamma),
      0
    ]
    basisZ[ 2 ] = Math.sqrt(
      h.zlen * h.zlen * Math.sin(Math.PI / 180.0 * h.beta) *
      Math.sin(Math.PI / 180.0 * h.beta) - basisZ[ 1 ] * basisZ[ 1 ]
    )

    const basis = [ [], basisX, basisY, basisZ ]
    const nxyz = [ 0, h.xRate, h.yRate, h.zRate ]
    const mapcrs = [ 0, 1, 2, 3 ]

    const matrix = new Matrix4()

    matrix.set(
      basis[ mapcrs[1] ][0] / nxyz[ mapcrs[1] ],
      basis[ mapcrs[2] ][0] / nxyz[ mapcrs[2] ],
      basis[ mapcrs[3] ][0] / nxyz[ mapcrs[3] ],
      0,
      basis[ mapcrs[1] ][1] / nxyz[ mapcrs[1] ],
      basis[ mapcrs[2] ][1] / nxyz[ mapcrs[2] ],
      basis[ mapcrs[3] ][1] / nxyz[ mapcrs[3] ],
      0,
      basis[ mapcrs[1] ][2] / nxyz[ mapcrs[1] ],
      basis[ mapcrs[2] ][2] / nxyz[ mapcrs[2] ],
      basis[ mapcrs[3] ][2] / nxyz[ mapcrs[3] ],
      0,
      0, 0, 0, 1
    )

    matrix.multiply(
      new Matrix4().makeRotationY(degToRad(90))
    )

    matrix.multiply(new Matrix4().makeTranslation(
      -h.zStart, h.yStart, h.xStart
    ))

    matrix.multiply(new Matrix4().makeScale(
      -1, 1, 1
    ))

    return matrix
  }
开发者ID:arose,项目名称:ngl,代码行数:65,代码来源:dsn6-parser.ts


注:本文中的THREE.Matrix4.multiply方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。