lib/to_openstudio/geometry/door.rb in honeybee-openstudio-2.28.1 vs lib/to_openstudio/geometry/door.rb in honeybee-openstudio-2.28.2
- old
+ new
@@ -46,18 +46,17 @@
# create the OpenStudio door object
os_vertices = OpenStudio::Point3dVector.new
@hash[:geometry][:boundary].each do |vertex|
os_vertices << OpenStudio::Point3d.new(vertex[0], vertex[1], vertex[2])
end
- reordered_vertices = OpenStudio.reorderULC(os_vertices)
# triangulate subsurface if neccesary
triangulated = false
final_vertices_list = []
matching_os_subsurfaces = []
matching_os_subsurface_indices = []
- if reordered_vertices.size > 4
+ if os_vertices.size > 4
# if this door has a matched door, see if the other one has already been created
# the matched door should have been converted to multiple subsurfaces
if @hash[:boundary_condition][:type] == 'Surface'
adj_srf_identifier = @hash[:boundary_condition][:boundary_condition_objects][0]
@@ -73,21 +72,21 @@
# if other door is not already created, do the triangulation
if final_vertices_list.empty?
# transform to face coordinates
- t = OpenStudio::Transformation::alignFace(reordered_vertices)
+ t = OpenStudio::Transformation::alignFace(os_vertices)
tInv = t.inverse
- face_vertices = OpenStudio::reverse(tInv*reordered_vertices)
+ face_vertices = OpenStudio::reverse(tInv*os_vertices)
# no holes in the subsurface
holes = OpenStudio::Point3dVectorVector.new
# triangulate surface
triangles = OpenStudio::computeTriangulation(face_vertices, holes)
if triangles.empty?
- raise "Failed to triangulate door #{@hash[:identifier]} with #{reordered_vertices.size} vertices"
+ raise "Failed to triangulate door #{@hash[:identifier]} with #{os_vertices.size} vertices"
end
# create new list of surfaces
triangles.each do |vertices|
final_vertices_list << OpenStudio.reorderULC(OpenStudio::reverse(t*vertices))
@@ -96,17 +95,17 @@
triangulated = true
end
else
- # reordered_vertices are good as is
- final_vertices_list << reordered_vertices
+ # os_vertices are good as is
+ final_vertices_list << os_vertices
end
result = []
- final_vertices_list.each_with_index do |reordered_vertices, index|
- os_subsurface = OpenStudio::Model::SubSurface.new(reordered_vertices, openstudio_model)
+ final_vertices_list.each_with_index do |os_vertices, index|
+ os_subsurface = OpenStudio::Model::SubSurface.new(os_vertices, openstudio_model)
if !matching_os_subsurfaces.empty?
os_subsurface.setName(@hash[:identifier] + "..#{matching_os_subsurface_indices[index]}")
elsif triangulated
os_subsurface.setName(@hash[:identifier] + "..#{index}")
@@ -166,12 +165,11 @@
# create the openstudio shading surface
os_vertices = OpenStudio::Point3dVector.new
hb_verts.each do |vertex|
os_vertices << OpenStudio::Point3d.new(vertex[0], vertex[1], vertex[2])
end
- reordered_vertices = OpenStudio.reorderULC(os_vertices)
- os_shading_surface = OpenStudio::Model::ShadingSurface.new(reordered_vertices, openstudio_model)
+ os_shading_surface = OpenStudio::Model::ShadingSurface.new(os_vertices, openstudio_model)
os_shading_surface.setName(@hash[:identifier])
unless @hash[:display_name].nil?
os_shading_surface.setDisplayName(@hash[:display_name])
end