MCPcopy Create free account
hub / github.com/CNCKitchen/stlTexturizer / computeTriEdges

Function computeTriEdges

js/smartResolution.js:221–235  ·  view source on GitHub ↗

* Pre-compute the three edge lengths of every triangle in `geometry`. * Returned Float64Array has 3 entries per triangle (no winding semantics).

(geometry)

Source from the content-addressed store, hash-verified

219 return total;
220}
221
222/**
223 * Predict the triangle count `subdivide(geometry, edge)` will produce, by
224 * simulating the per-triangle split pattern. Useful as a pre-flight check on
225 * the user's chosen refineLength.
226 *
227 * @param {THREE.BufferGeometry} geometry
228 * @param {number} edge Target maximum edge length, same units as positions.
229 * @returns {number} Predicted post-subdivision triangle count.
230 */
231export function estimateSubdivisionTriCount(geometry, edge) {
232 if (!geometry || !geometry.attributes || !geometry.attributes.position) return 0;
233 return simulateFromEdges(computeTriEdges(geometry), edge);
234}
235
236/**
237 * @param {object} args
238 * @param {THREE.BufferGeometry} args.geometry Current working geometry.

Callers 2

computeSmartResolutionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected