ladybug-tools / spider-2020

Your 2020 3D happy place for online browsing of building data files
http://ladybug.tools/spider-2020/
MIT License
4 stars 1 forks source link

Sanitize point order for all honeybee models #16

Closed cdriesler closed 3 years ago

cdriesler commented 4 years ago

Honeybee models provided with inconsistent (or even out of order) point data do not render correctly with the current three.js geometry creation routine. Concave shapes appear to be especially stubborn, but this might end up being a separate issue.

Per earlier discussion - sounds like the best move is to validate/sanitize point order for incoming honeybee geometry in the viewer itself. (Instead of expecting it to be right.)

@theo-armour pointed out that this should be possible with the ShapeUtils that ship with recent versions of three.js. The .isClockwise method, mixed with a good existing clockwise point ordering algorithm, makes a believable fix for a solution.

I plan to circle back with a solution in a few days. Wanted to open this up to get discussion going on any other strategies.

theo-armour commented 4 years ago

@cdriesler

In recent version of the Spider gbXML Viewer I have reverted to the the Three.js ShapeUtils.triangulateShape method instead of new Shape. The former is most difficult to set up but has the advantage of having been seen too generate inumerable renderings that appear to have no errors.

The current Spider Pollination Viewer (SPV) is suited to large modules with many thousands of faces where loading speed and low latency are of the essence and the occasional mis-drawn face is not a critical issue.

The downside to current Shape implementation in SPV is that in order to achieve speed face data is tightly bundled into high speed integer arrays which means displaying just a few individual spaces or stories will requires some heavy lifting in order to be implemented.

Future forks of the SPV could implement the traiangulatShape method and revert to faces being bundled into individual polygons.


BTW, I looked at these two files - uploaded by Mostapha:

The data handling of the files is of such a difference that I cannot even begin to wonder how to compare the issues. ;-(

mostaphaRoudsari commented 4 years ago

Hi @theo-armour, sorry if the other model has too much going on. I created a single room model that shows two problems that we currently have in the viewer. It's a single corridor. The model should look like this:

image

But if you open it in the viewer as is, it will look like this.

image

As you can see the windows are missing and the roof is not showing correctly. After sorting the vertices the windows will show up but the roof still doesn't render correctly.

image

I'm attaching 3 different files in this zip file:

I change the face's display name to Wall with openings so it is easier to find. The apertures are named Aperture 0, Aperture 1 and Aperture 2.

I hope this model can be helpful to find the root of the problem.

corridor.zip

cdriesler commented 3 years ago

Resolved! Thank you for the reference Theo.

theo-armour commented 3 years ago

Nice!

On Mon, Nov 16, 2020 at 8:42 PM Chuck Driesler notifications@github.com wrote:

Closed #16 https://github.com/ladybug-tools/spider-2020/issues/16.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ladybug-tools/spider-2020/issues/16#event-4003546668, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEFWKWKIBA64DMFU3VPOTLSQH5MLANCNFSM4PMCER5Q .