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


TypeScript THREE.Box3类代码示例

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


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

示例1: getBox

  getBox (center: Vector3, size: number, target: Box3) {
    if (!target) target = new Box3()

    target.set(center, center)
    target.expandByScalar(size)
    target.applyMatrix4(this.inverseMatrix)

    target.min.round()
    target.max.round()

    return target
  }
开发者ID:arose,项目名称:ngl,代码行数:12,代码来源:volume.ts

示例2: computeBoundingBox

  computeBoundingBox () {
    if (!this.boundingBox) {
      this.boundingBox = new Box3()
    } else {
      this.boundingBox.empty()
    }

    this.geometryList.forEach(geo => {
      if (!geo.boundingBox) geo.computeBoundingBox()
      this.boundingBox.union(geo.boundingBox)
    })
  }
开发者ID:arose,项目名称:ngl,代码行数:12,代码来源:geometry-group.ts

示例3: setParameters

  /**
   * Set representation parameters
   * @alias SurfaceRepresentation#setParameters
   * @param {SurfaceRepresentationParameters} params - surface parameter object
   * @param {Object} [what] - buffer data attributes to be updated,
   *                        note that this needs to be implemented in the
   *                        derived classes. Generally it allows more
   *                        fine-grained control over updating than
   *                        forcing a rebuild.
   * @param {Boolean} what.position - update position data
   * @param {Boolean} what.color - update color data
   * @param {Boolean} [rebuild] - whether or not to rebuild the representation
   * @return {SurfaceRepresentation} this object
   */
  setParameters (params: Partial<SurfaceRepresentationParameters>, what?: SurfaceDataFields, rebuild?: boolean) {
    if (params && params.isolevelType !== undefined &&
      this.volume
    ) {
      if (this.isolevelType === 'value' &&
        params.isolevelType === 'sigma'
      ) {
        this.isolevel = this.volume.getSigmaForValue(this.isolevel)
      } else if (this.isolevelType === 'sigma' &&
        params.isolevelType === 'value'
      ) {
        this.isolevel = this.volume.getValueForSigma(this.isolevel)
      }

      this.isolevelType = params.isolevelType
    }

    if (params && params.boxCenter) {
      this.boxCenter.copy(params.boxCenter)
      delete params.boxCenter
    }

    // Forbid wireframe && contour as in molsurface
    if (params && params.wireframe && (
      params.contour || (params.contour === undefined && this.contour)
    )) {
      params.wireframe = false
    }

    super.setParameters(params, what, rebuild)

    if (this.volume) {
      this.volume.getBox(this.boxCenter, this.boxSize, this.box)
    }

    if (params && params.colorVolume !== undefined) {
      if (what) what.color = true
    }

    if (this.surface && (
      params.isolevel !== undefined ||
      params.negateIsolevel !== undefined ||
      params.smooth !== undefined ||
      params.wrap !== undefined ||
      params.boxSize !== undefined ||
      (this.boxSize > 0 &&
        !this.__box.equals(this.box))
    )) {
      this.build({
        'position': true,
        'color': true,
        'index': true,
        'normal': !this.contour
      })
    }

    return this
  }
开发者ID:arose,项目名称:ngl,代码行数:72,代码来源:surface-representation.ts

示例4: prepare

  prepare (callback: () => void) {
    if (this.volume) {
      let isolevel

      if (this.isolevelType === 'sigma') {
        isolevel = this.volume.getValueForSigma(this.isolevel)
      } else {
        isolevel = this.isolevel
      }
      if (this.negateIsolevel) isolevel *= -1

      if (!this.surface ||
        this.__isolevel !== isolevel ||
        this.__smooth !== this.smooth ||
        this.__contour !== this.contour ||
        this.__wrap !== this.wrap ||
        this.__boxSize !== this.boxSize ||
        (this.boxSize > 0 &&
            !this.__boxCenter.equals(this.boxCenter))
      ) {
        this.__isolevel = isolevel
        this.__smooth = this.smooth
        this.__contour = this.contour
        this.__wrap = this.wrap
        this.__boxSize = this.boxSize
        this.__boxCenter.copy(this.boxCenter)
        this.__box.copy(this.box)

        const onSurfaceFinish = (surface: Surface) => {
          this.surface = surface
          callback()
        }

        if (this.useWorker) {
          this.volume.getSurfaceWorker(
            isolevel, this.smooth, this.boxCenter, this.boxSize,
            this.contour, this.wrap, onSurfaceFinish
          )
        } else {
          onSurfaceFinish(
            this.volume.getSurface(
              isolevel, this.smooth, this.boxCenter, this.boxSize,
              this.contour, this.wrap
            )
          )
        }
      } else {
        callback()
      }
    } else {
      callback()
    }
  }
开发者ID:arose,项目名称:ngl,代码行数:53,代码来源:surface-representation.ts

示例5: refresh

  /**
   * Updates atomSet, bondSet, atomSetCache, atomCount, bondCount, boundingBox, center.
   * @emits {Structure.signals.refreshed} when refreshed
   * @return {undefined}
   */
  refresh () {
    if (Debug) Log.time('StructureView.refresh')

    this.atomSetCache = {}
    const structure = this.structure

    if (this.selection.isAllSelection() &&
        structure !== this && structure.atomSet && structure.bondSet
    ) {
      this.atomSet = structure.atomSet.clone()
      this.bondSet = structure.bondSet.clone()

      for (let name in this.atomSetDict) {
        const atomSet = this.atomSetDict[ name ]
        this.atomSetCache[ '__' + name ] = atomSet.clone()
      }

      this.atomCount = structure.atomCount
      this.bondCount = structure.bondCount

      this.boundingBox.copy(structure.boundingBox)
      this.center.copy(structure.center)
    } else if (this.selection.isNoneSelection() &&
        structure !== this && structure.atomSet && structure.bondSet
    ) {
      this.atomSet = new BitArray(structure.atomCount)
      this.bondSet = new BitArray(structure.bondCount)

      for (let name in this.atomSetDict) {
        this.atomSetCache[ '__' + name ] = new BitArray(structure.atomCount)
      }

      this.atomCount = 0
      this.bondCount = 0

      this.boundingBox.makeEmpty()
      this.center.set(0, 0, 0)
    } else {
      this.atomSet = this.getAtomSet(this.selection, true)
      if (structure.atomSet) {
        this.atomSet = this.atomSet.intersection(structure.atomSet)
      }

      this.bondSet = this.getBondSet()

      for (let name in this.atomSetDict) {
        const atomSet = this.atomSetDict[ name ]
        this.atomSetCache[ '__' + name ] = atomSet.makeIntersection(this.atomSet)
      }

      this.atomCount = this.atomSet.getSize()
      this.bondCount = this.bondSet.getSize()

      this.boundingBox = this.getBoundingBox()
      this.center = this.boundingBox.getCenter(new Vector3())
    }

    if (Debug) Log.timeEnd('StructureView.refresh')

    this.signals.refreshed.dispatch()
  }
开发者ID:arose,项目名称:ngl,代码行数:66,代码来源:structure-view.ts

示例6:

 this.geometryList.forEach(geo => {
   if (!geo.boundingBox) geo.computeBoundingBox()
   this.boundingBox.union(geo.boundingBox)
 })
开发者ID:arose,项目名称:ngl,代码行数:4,代码来源:geometry-group.ts


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