NREL / OpenStudio

OpenStudio is a cross-platform collection of software tools to support whole building energy modeling using EnergyPlus and advanced daylight analysis using Radiance.
https://www.openstudio.net/
Other
505 stars 192 forks source link

Concerning roof geometry from floor js json import #4489

Open antonszilasi opened 3 years ago

antonszilasi commented 3 years ago

Issue overview

I am using the following code to import this floor js json into OpenStudio

 floorplan = OpenStudio::FloorplanJS::load(floor_js_json_data)
  if floorplan.empty?
    raise "Cannot load floorplan from '#{floorplan_path}'."
  end

  scene = floorplan.get.toThreeScene(true)

  rt = OpenStudio::Model::ThreeJSReverseTranslator.new

  model = rt.modelFromThreeJS(scene)

Concerning roof geometry is produced from the floor js json import

The space seen in the screenshot below:

image

Produces the roof geometry below:

image

Although the floor geometry comes out just fine

image

Please find the floor js json from here:

https://drive.google.com/file/d/13b4EYEykWXPemMIaas-jPsCy7i-GOHid/view?usp=sharing

Environment

OpenStudio 3.2.0

ggartside commented 1 year ago

What I think is happening here is that when the Roof/Ceiling of Space 1-1 is intersected with the floor of a space in story 2 the result is a surface with an inner path (a hole) and we can't have inner paths in surfaces so the result has to be triangulated in to several surfaces that don't have inner paths.

When the surfaces are intersected new Surface objects are immediately created and added to the surface list which precludes preserving inner paths until the end of the intersection operation. If the intersections were kept as boost polygons until all the intersections were completed and then any inner paths were removed then this likely would result in no triangulation being needed

However this would be a major (complete!) rewrite of Intersections and I don't think we really want to do that given how fundamental this piece of code is

IntersectionResult (which is the result returned from intersect, returns a list of Point3d and a list of Point3d vectors so it does not allow for a polygon with inner paths to be returned.

And here is the code that removes holes image