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


TypeScript Box3.getCenter方法代码示例

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


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

示例1: 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


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