本文整理汇总了TypeScript中neuroglancer/mesh/triangle_strips.computeTriangleStrips函数的典型用法代码示例。如果您正苦于以下问题:TypeScript computeTriangleStrips函数的具体用法?TypeScript computeTriangleStrips怎么用?TypeScript computeTriangleStrips使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了computeTriangleStrips函数的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('works for random partitioned examples', () => {
const numVertices = 10;
const numTriangles = 20 + 30 + 40 + 50;
for (let iter = 0; iter < 10; ++iter) {
const indices = makeRandomIndices(numTriangles, numVertices);
const subChunkOffsets =
Uint32Array.of(0, 20 * 3, (20 + 30) * 3, (20 + 30 + 40) * 3, (20 + 30 + 40 + 50) * 3);
const outputSubChunkOffsets = new Uint32Array(subChunkOffsets);
const output = computeTriangleStrips(new Uint32Array(indices), outputSubChunkOffsets);
// console.log('indices', Array.from(indices));
// console.log('output', Array.from(output));
for (let subChunk = 0; subChunk < 4; ++subChunk) {
const outputBegin = outputSubChunkOffsets[subChunk],
outputEnd = outputSubChunkOffsets[subChunk + 1];
expect(outputBegin).toBeLessThanOrEqual(outputEnd);
expect(outputBegin).toBeGreaterThanOrEqual(0);
expect(outputEnd).toBeLessThanOrEqual(output.length);
const newTriangles = getTrianglesFromStrips(output.subarray(outputBegin, outputEnd));
const origTriangles = getTrianglesFromIndices(
indices.subarray(subChunkOffsets[subChunk], subChunkOffsets[subChunk + 1]));
expect(newTriangles).toEqual(origTriangles);
}
}
});