本文整理汇总了TypeScript中THREE.Vector3.positionToArray方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Vector3.positionToArray方法的具体用法?TypeScript Vector3.positionToArray怎么用?TypeScript Vector3.positionToArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类THREE.Vector3
的用法示例。
在下文中一共展示了Vector3.positionToArray方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: nearest
nearest (point: number[]|Vector3, maxNodes: number, maxDistance: number) {
// Log.time( "Kdtree nearest" );
if (point instanceof Vector3) {
point.toArray(pointArray as any)
} else if (point instanceof AtomProxy) {
point.positionToArray(pointArray)
}
const nodeList = this.kdtree.nearest(pointArray, maxNodes, maxDistance)
const indices = this.kdtree.indices
const nodes = this.kdtree.nodes
const atomIndices = this.atomIndices
const resultList = []
for (let i = 0, n = nodeList.length; i < n; ++i) {
const d = nodeList[ i ]
const nodeIndex = d[ 0 ]
const dist = d[ 1 ]
resultList.push({
index: atomIndices[ indices[ nodes[ nodeIndex ] ] ],
distance: dist
})
}
// Log.timeEnd( "Kdtree nearest" );
return resultList
}