| 1234567891011 |
- import assert from 'node:assert/strict'
- import {surveyShell,verifyClosedTriangles} from './far-shell-geometry.mjs'
- const a={id:'rect',footprintENU:[[0,0],[10,0],[10,5],[0,5]],foundationBottom:1,positionENU:[5,2.5,2],heightM:8}
- const l={id:'l',footprintENU:[[0,0],[10,0],[10,3],[4,3],[4,8],[0,8]],foundationBottom:1,positionENU:[5,4,2],heightM:8}
- const collinear={...a,id:'collinear',footprintENU:[[0,0],[5,0],[10,0],[10,5],[0,5],[0,2.5]]}
- const shifted={...l,id:'large-coordinates',footprintENU:l.footprintENU.map(([x,y])=>[x+1100,y+1700])}
- for(const b of [a,l,collinear,shifted]){const g=surveyShell(b);verifyClosedTriangles([...g.roof,...g.body]);assert.ok(g.triangles<=20_000);assert.equal(g.top,b.positionENU[2]+b.heightM)}
- const g=surveyShell(a),complete=[...g.roof,...g.body]
- assert.throws(()=>verifyClosedTriangles(complete.slice(1)))
- assert.throws(()=>verifyClosedTriangles([complete[0].toReversed(),...complete.slice(1)]))
- assert.throws(()=>surveyShell({...a,footprintENU:[[0,0],[1,0]]}));assert.throws(()=>surveyShell({...a,heightM:-1}));console.log(JSON.stringify({passed:true,scope:'closed surveyed exterior shell area/LOD budget/invalid outline rejection'}))
|