本文整理匯總了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);
}
}
});