Skip to content

Commit

Permalink
Reinstates vector length >0 check
Browse files Browse the repository at this point in the history
  • Loading branch information
brgix committed Oct 15, 2024
1 parent b22d167 commit 7a652f7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 49 deletions.
6 changes: 3 additions & 3 deletions lib/measures/tbd/measure.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<schema_version>3.1</schema_version>
<name>tbd_measure</name>
<uid>8890787b-8c25-4dc8-8641-b6be1b6c2357</uid>
<version_id>aee19ec9-586a-4cfe-b6fa-892fe979c6de</version_id>
<version_modified>2024-10-15T17:24:59Z</version_modified>
<version_id>8d1bf83f-e7e2-4d4d-8093-14e546d1fdea</version_id>
<version_modified>2024-10-15T18:44:28Z</version_modified>
<xml_checksum>99772807</xml_checksum>
<class_name>TBDMeasure</class_name>
<display_name>Thermal Bridging and Derating - TBD</display_name>
Expand Down Expand Up @@ -523,7 +523,7 @@
<filename>psi.rb</filename>
<filetype>rb</filetype>
<usage_type>resource</usage_type>
<checksum>928CC0FE</checksum>
<checksum>D305D750</checksum>
</file>
<file>
<filename>tbd.rb</filename>
Expand Down
45 changes: 0 additions & 45 deletions lib/measures/tbd/resources/psi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1723,19 +1723,6 @@ def process(model = nil, argh = {})
farthest = Topolys::Point3D.new(origin.x, origin.y, origin.z)
farthest_V = farthest - origin # zero magnitude, initially
farthest_mag = 0
# inverted = false
# i_origin = wire.points.index(origin)
# i_terminal = wire.points.index(terminal)
# i_last = wire.points.size - 1

# if i_terminal == 0
# inverted = true unless i_origin == i_last
# elsif i_origin == i_last
# inverted = true unless i_terminal == 0
# else
# puts "#{i_terminal} vs #{i_origin} !!!!" unless i_terminal - i_origin == 1
# inverted = true unless i_terminal - i_origin == 1
# end

wire.points.each do |point|
next if point == origin
Expand All @@ -1745,27 +1732,6 @@ def process(model = nil, argh = {})
origin_point_V = point_on_plane - origin
point_V_mag = origin_point_V.magnitude
next unless point_V_mag > TOL

# Generate a plane between origin, terminal & point. Only consider
# planes that share the same normal as wire.
# if inverted
# plane = Topolys::Plane3D.from_points(terminal, origin, point)
# else
# plane = Topolys::Plane3D.from_points(origin, terminal, point)
# end
#
# dnx = (normal.x - plane.normal.x).abs
# dny = (normal.y - plane.normal.y).abs
# dnz = (normal.z - plane.normal.z).abs

# if id == "Level 0 Open area 1 Ceiling Plenum RoofCeiling" && horizontal && edge_V.magnitude.round(2) == 2.14
# # puts "point = #{point} (#{dnx.round(3)} :: #{dny.round(3)} :: #{dnz.round(3)})"
# puts "point = #{point} (#{inverted} : #{i_origin} vs #{i_terminal})"
# puts "MAG 2,7 == #{point_V_mag}" if point.x.round(3) == 2.016 && point.y.round(3) == 7.400
# puts "MAG -4,5 == #{point_V_mag}" if point.x.round(3) == -4.608 && point.y.round(3) == 5.552
# end

# next unless dnx < TOL && dny < TOL && dnz < TOL
next unless point_V_mag > farthest_mag

farthest = point
Expand All @@ -1790,23 +1756,12 @@ def process(model = nil, argh = {})
end
end

# ngle = angle

angle = 2 * Math::PI - angle if adjust
angle -= 2 * Math::PI if (angle - 2 * Math::PI).abs < TOL
surface[:angle ] = angle
farthest_V.normalize!
surface[:polar ] = farthest_V
surface[:normal] = normal

# if id == "Level 0 Open area 1 Ceiling Plenum RoofCeiling" && horizontal && edge_V.magnitude.round(2) == 2.14
# puts "l'angle === #{(angle * 180 / Math::PI).round(2)} (vs #{(ngle * 180 / Math::PI).round(2)})"
# puts "#{surface[:polar]} (#{farthest}) : #{adjust}"
# puts "#{origin} vs #{terminal}"
# # puts
# # puts wire.points
# puts
# end
end # end of edge-linked, surface-to-wire loop
end # end of edge-linked surface loop

Expand Down
18 changes: 17 additions & 1 deletion lib/tbd/psi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1731,6 +1731,7 @@ def process(model = nil, argh = {})
point_on_plane = edge_plane.project(point)
origin_point_V = point_on_plane - origin
point_V_mag = origin_point_V.magnitude
next unless point_V_mag > TOL
next unless point_V_mag > farthest_mag

farthest = point
Expand Down Expand Up @@ -2152,7 +2153,22 @@ def process(model = nil, argh = {})
concave = concave?(s1, s2)
convex = convex?(s1, s2)
flat = !concave && !convex


# if (id == "Level0 Open area 1 Ceiling Plenum AbvClgPlnmWall 4" &&
# i == "Level 0 Open area 1 Ceiling Plenum RoofCeiling") ||
# (i == "Level0 Open area 1 Ceiling Plenum AbvClgPlnmWall 4" &&
# id == "Level 0 Open area 1 Ceiling Plenum RoofCeiling")
# puts
# puts; puts "... #{id} vs #{i}"
# puts "ANGLE: #{(s1[:angle] * 180 / Math::PI).round(2)} vs #{(s2[:angle] * 180 / Math::PI).round(2)}"
# puts "POLAR: #{s1[:polar]} vs #{s2[:polar]}"
# puts "NORMAL: #{s1[:normal]} vs #{s2[:normal]}"
# puts
# puts convex?(s1, s2)
# puts "..."
# puts
# end

if argh[:parapet]
set[:parapet ] = shorts[:val][:parapet ] if flat
set[:parapetconcave] = shorts[:val][:parapetconcave] if concave
Expand Down

0 comments on commit 7a652f7

Please sign in to comment.