本文整理汇总了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
}
示例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)
})
}
示例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
}
示例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()
}
}
示例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()
}
示例6:
this.geometryList.forEach(geo => {
if (!geo.boundingBox) geo.computeBoundingBox()
this.boundingBox.union(geo.boundingBox)
})