本文整理汇总了TypeScript中babylonjs/Maths/math.Vector3.asArray方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Vector3.asArray方法的具体用法?TypeScript Vector3.asArray怎么用?TypeScript Vector3.asArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类babylonjs/Maths/math.Vector3
的用法示例。
在下文中一共展示了Vector3.asArray方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: _CalculateMinMaxPositions
/**
* Calculates the minimum and maximum values of an array of position floats
* @param positions Positions array of a mesh
* @param vertexStart Starting vertex offset to calculate min and max values
* @param vertexCount Number of vertices to check for min and max values
* @returns min number array and max number array
*/
public static _CalculateMinMaxPositions(positions: FloatArray, vertexStart: number, vertexCount: number, convertToRightHandedSystem: boolean): { min: number[], max: number[] } {
const min = [Infinity, Infinity, Infinity];
const max = [-Infinity, -Infinity, -Infinity];
const positionStrideSize = 3;
let indexOffset: number;
let position: Vector3;
let vector: number[];
if (vertexCount) {
for (let i = vertexStart, length = vertexStart + vertexCount; i < length; ++i) {
indexOffset = positionStrideSize * i;
position = Vector3.FromArray(positions, indexOffset);
if (convertToRightHandedSystem) {
_GLTFUtilities._GetRightHandedPositionVector3FromRef(position);
}
vector = position.asArray();
for (let j = 0; j < positionStrideSize; ++j) {
let num = vector[j];
if (num < min[j]) {
min[j] = num;
}
if (num > max[j]) {
max[j] = num;
}
++indexOffset;
}
}
}
return { min, max };
}