NREL / floorspace.js

Other
66 stars 35 forks source link

fix(createFaceFromPoints): fix calculating intersectedFaces #364

Open macintoshpie opened 4 years ago

macintoshpie commented 4 years ago

I found an issue in loading an exported floorplan (see file Performance Degradation.json in this thread #348 ). It throws the following exception:

TypeError: coords[0] is undefinedapp.js line 726 > eval:61:7
    toTurfPoly http://localhost:8080/app.js line 726 > eval:61
    setOperation http://localhost:8080/app.js line 726 > eval:274
    intersection http://localhost:8080/app.js line 726 > eval:295
    intersectedFaces http://localhost:8080/app.js line 2784 > eval:122
    filter self-hosted:318
    newGeometriesOfOverlappedFaces http://localhost:8080/app.js line 2784 > eval:121
    createFaceFromPoints http://localhost:8080/app.js line 2784 > eval:94
    wrappedActionHandler http://localhost:8080/app.js line 768 > eval:706
    dispatch http://localhost:8080/app.js line 768 > eval:428
    boundDispatch http://localhost:8080/app.js line 768 > eval:334
    overrideDispatch http://localhost:8080/app.js line 2868 > eval:94
    saveRectangularFace http://localhost:8080/app.js line 2736 > eval:487
    boundFn http://localhost:8080/app.js line 606 > eval:191
    addPoint http://localhost:8080/app.js line 2736 > eval:235
    boundFn http://localhost:8080/app.js line 606 > eval:191
    gridClicked http://localhost:8080/app.js line 2736 > eval:64
    boundFn http://localhost:8080/app.js line 606 > eval:189
    contextListener http://localhost:8080/app.js line 1026 > eval:124

Steps to replicate:

For some reason this model has some faces with no vertices, so we need to check if that's the case and skip it if so.