Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autogenerate skylight wells (redux) #17

Merged
merged 13 commits into from
Apr 17, 2024
55 changes: 55 additions & 0 deletions spec/osut_tests_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1818,7 +1818,62 @@ module M
expect(mod1.reset(DBG)).to eq(DBG)
expect(mod1.level).to eq(DBG)
expect(mod1.clean!).to eq(DBG)
v = OpenStudio.openStudioVersion.split(".").join.to_i

p1 = OpenStudio::Point3dVector.new
p2 = OpenStudio::Point3dVector.new

p1 << OpenStudio::Point3d.new(3.63, 0, 4.03)
p1 << OpenStudio::Point3d.new(3.63, 0, 2.44)
p1 << OpenStudio::Point3d.new(7.34, 0, 2.44)
p1 << OpenStudio::Point3d.new(7.34, 0, 4.03)

t = OpenStudio::Transformation.alignFace(p1)

if v < 340
Copy link
Member Author

@brgix brgix Apr 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OSut's overlap relies on the OpenStudio.intersect function to extract a potential overlapping area (i.e. a polygon) shared between 2 intersecting polygons. TBD relies on OSut's overlap to detect conflicts when dealing with fenestrated subsurfaces with Frame & Divider frames (where widths are often fairly narrow, e.g. 3cm to 6cm). I'm unable to isolate why (maybe linked to this fix), but OpenStudio.intersect fails for intersection widths < 5cm for versions v3.2.1 through v3.3.0. It works fine for versions > v3.3.0 (in fact, it works for v3.0.0 as well). So here, I'm simply relaxing the test for v3.2.1 and v3.3.0, as I have no intention in developing a backwards-compatible workaround for something like 3cm frame widths (for older SDK versions) ... so user beware :]

p2 << OpenStudio::Point3d.new(3.63, 0, 2.49)
p2 << OpenStudio::Point3d.new(3.63, 0, 1.00)
p2 << OpenStudio::Point3d.new(7.34, 0, 1.00)
p2 << OpenStudio::Point3d.new(7.34, 0, 2.49)
else
p2 << OpenStudio::Point3d.new(3.63, 0, 2.47)
p2 << OpenStudio::Point3d.new(3.63, 0, 1.00)
p2 << OpenStudio::Point3d.new(7.34, 0, 1.00)
p2 << OpenStudio::Point3d.new(7.34, 0, 2.47)
end

area1 = OpenStudio.getArea(p1)
area2 = OpenStudio.getArea(p2)
expect(area1).to_not be_empty
expect(area2).to_not be_empty
area1 = area1.get
area2 = area2.get

p1a = t.inverse * p1
p2a = t.inverse * p2

union = OpenStudio.join(p1a.reverse, p2a.reverse, TOL2)
expect(union).to_not be_empty
union = union.get
area = OpenStudio.getArea(union)
expect(area).to_not be_empty
area = area.get
delta = area1 + area2 - area

res = OpenStudio.intersect(p1a.reverse, p2a.reverse, TOL)
expect(res).to_not be_empty
res = res.get
res1 = res.polygon1
expect(res1).to_not be_empty

res1_m2 = OpenStudio.getArea(res1)
expect(res1_m2).to_not be_empty
res1_m2 = res1_m2.get
expect(res1_m2).to be_within(TOL2).of(delta)
expect(mod1.overlaps?(p1a, p2a)).to be true
expect(mod1.status).to be_zero

# --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- #
# Tests line intersecting line segments.
sg1 = OpenStudio::Point3dVector.new
sg1 << OpenStudio::Point3d.new(18, 0, 0)
Expand Down
Loading