Skip to content

Commit a1a8612

Browse files
committed
Adds 'realignFace' to 'spaceWidth'
1 parent c53fe28 commit a1a8612

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

lib/osut/utils.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4615,10 +4615,14 @@ def spaceWidth(space = nil)
46154615
polygs = polygs.map { |plg| plg.to_a.reverse }
46164616
union = OpenStudio.joinAll(polygs, 0.01).first
46174617
polyg = poly(union, false, true, true)
4618+
return 0 if polyg.empty?
46184619
end
46194620
end
46204621

4621-
height(boundedBox(polyg))
4622+
res = realignedFace(polyg.to_a.reverse)
4623+
return 0 if res[:box].nil?
4624+
4625+
height(res[:box])
46224626
end
46234627

46244628
##

spec/osut_tests_spec.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5785,8 +5785,8 @@ module M
57855785
# corridors with multiple concavities).
57865786
expect(mod1.spaceHeight(fine)).to be_within(TOL).of(8.53)
57875787
expect(mod1.spaceWidth(fine)).to be_within(TOL).of(21.33)
5788-
expect(mod1.status).to eq(0)
57895788

5789+
# --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- #
57905790
file = File.join(__dir__, "files/osms/out/seb_sky.osm")
57915791
path = OpenStudio::Path.new(file)
57925792
model = translator.loadModel(path)
@@ -5804,6 +5804,8 @@ module M
58045804
expect(mod1.alignedHeight(floor)).to be_within(TOL).of(6.88)
58055805
expect(mod1.alignedWidth(floor)).to be_within(TOL).of(8.22)
58065806
expect(mod1.spaceHeight(openarea)).to be_within(TOL).of(3.96)
5807-
expect(mod1.spaceWidth(openarea)).to be_within(TOL).of(7.90)
5807+
expect(mod1.spaceWidth(openarea)).to be_within(TOL).of(3.77)
5808+
5809+
expect(mod1.status).to eq(0)
58085810
end
58095811
end

0 commit comments

Comments
 (0)