Builtin Library
- ..
- .metadata198 B
- README.md1.6 KB
- init.luau3.2 KB
- validate.module
README.md
debug.validate (procNode)
Validate a Geometry, answering a Data report of any issues: an index outside the point range, a NaN position coordinate, and the triangles naming one point twice. The checks are reductions on the device, read back once into the report. Wire it after a node that builds or edits topology to catch a broken link before it reaches a mesh.
Inputs
value(Geometry). The Geometry checked. A vertex pointing outside the point range and a NaN position coordinate each contribute at most one entry toissues, at the first position found; every triangle naming one point twice is counted in full asdegenerateTriangles.validsaysissuescame back empty.
Outputs
report: the Data report{ kind = "Geometry", vertexCount, triangleCount, degenerateTriangles, issues, valid }.vertexCountis the number of points andtriangleCountthe number of triangles its primitives make.issueslists"index out of range at position <n>"(the 1-based place of the first vertex whose point is outside the range) and"NaN vertex coordinate at position <n>"(the 1-based place of the first NaN in the flat list of coordinates).validis true whenissuesis empty; a degenerate triangle is counted and leavesvalidas it is.
Example
local report = g.debug.validate({ value = g.mesh.box({}) })
The box reports { kind = "Geometry", vertexCount = 24, triangleCount = 12, degenerateTriangles = 0, issues = {}, valid = true }. A geometry whose first vertex names point 99 of nine reports issues = { "index out of range at position 1" } and valid = false.