ladybug-tools / spider

:spider_web: 3D interactive analysis in your browser mostly written around the Three.js JavaScript library
http://www.ladybug.tools/spider
44 stars 15 forks source link

export gbxml issue - a surface with openings exports too many coordinates #81

Closed chiensiTB closed 6 years ago

chiensiTB commented 6 years ago

When an opening is added to a surface, effectively "holes" are punched in the surface. In three.js, this creates extra coordinates for that surface as I believe these are needed to render the surface properly.

However, upon export, most gbxml importers cannot handle these extra coordinates, and should be removed.

@theo-armour I am working on an algorithm to do this, have not nailed it yet. you may know of a more clever way to do it. the basic idea is you only want to include the extreme extents of the surface coordinates (the outermost) and throw out all the coordinates created when the openings were punched. Wonder what you think is the most expedient way to do this.

Idea 1:

Idead 2:

theo-armour commented 6 years ago

@chiensiTB

Interesting questions. Without seeing the lines of code you are dealing with, it is difficult to comment.

I find that gbXML and Three.js have very different methods for tackling 3D. I try to keep each in its own set of variables, objects and functions and very, very carefully throw data back and forth over the fence.

gbXML likes its surfaces to be closed polygons with its openings a multiple separate polygons

Three.js wants you to build a mesh from triangles or it wants you use the 2D Shape geometry with holes and/or a bunch of other ways

Given that you know gbXML far better than Three.js, have you thought of writing directly out to gbXML - and then viewing the result using the gbXMLViewer?

In any case that's how I plan to do things as and when I get back to Build Well. It might be a bit easier for me to use the gbJSON but writing a utility that creates L, T, H shapes or whatever and spits a gbGXML file should be a piece of cake.

I hope this helps. Do send links to code when you can.

chiensiTB commented 6 years ago

This issue has resolved. I am not sure if there are edge cases, but closed for now.