@@ -2624,10 +2624,86 @@ def test23_fits_overlaps(self):
26242624 pts = osut .nonCollinears (ceiling .vertices (), 3 )
26252625 box01 = osut .triadBox (pts )
26262626 box11 = osut .boundedBox (ceiling )
2627- print (o .logs ())
26282627 self .assertTrue (osut .areSame (box01 , box11 ))
26292628 self .assertTrue (osut .fits (box01 , ceiling ))
26302629
2630+ pts = osut .nonCollinears (roof .vertices (), 3 )
2631+ box02 = osut .medialBox (pts )
2632+ box12 = osut .boundedBox (roof )
2633+ self .assertTrue (osut .areSame (box02 , box12 ))
2634+ self .assertTrue (osut .fits (box02 , roof ))
2635+
2636+ box03 = osut .triadBox (pts )
2637+ self .assertFalse (osut .areSame (box03 , box12 ))
2638+ self .assertEqual (o .status (), 0 )
2639+
2640+ # For parallel surfaces, OSut's 'overlap' output is consistent
2641+ # regardless of the sequence of arguments. Here, floor and ceiling are
2642+ # mirrored - the former counterclockwise, the latter clockwise. The
2643+ # returned overlap conserves the vertex winding of the first surface.
2644+ self .assertTrue (osut .areParallel (floor , ceiling ))
2645+ olap1 = osut .overlap (floor , ceiling )
2646+ olap2 = osut .overlap (ceiling , floor )
2647+ self .assertTrue (osut .areSame (floor .vertices (), olap1 ))
2648+ self .assertTrue (osut .areSame (ceiling .vertices (), olap2 ))
2649+
2650+ # When surfaces aren't parallel, 'overlap' remains somewhat consistent
2651+ # if both share a common edge. Here, the flat soffit shares an edge
2652+ # with the sloped roof. The projection of the soffit neatly fits onto
2653+ # the roof, yet the generated overlap will obviously be distorted with
2654+ # respect to the original soffit vertices. Nonetheless, the shared
2655+ # vertices/edge(s) would be preserved.
2656+ olap1 = osut .overlap (soffit , roof , True )
2657+ olap2 = osut .overlap (roof , soffit , True )
2658+ self .assertTrue (osut .areParallel (olap1 , soffit ))
2659+ self .assertFalse (osut .areParallel (olap1 , roof ))
2660+ self .assertTrue (osut .areParallel (olap2 , roof ))
2661+ self .assertFalse (osut .areParallel (olap2 , soffit ))
2662+ self .assertEqual (len (olap1 ), 4 )
2663+ self .assertEqual (len (olap2 ), 4 )
2664+ area1 = openstudio .getArea (olap1 )
2665+ area2 = openstudio .getArea (olap2 )
2666+ self .assertTrue (area1 )
2667+ self .assertTrue (area2 )
2668+ area1 = area1 .get ()
2669+ area2 = area2 .get ()
2670+ self .assertGreater (abs (area1 - area2 ), TOL )
2671+ pl1 = openstudio .Plane (olap1 )
2672+ pl2 = openstudio .Plane (olap2 )
2673+ n1 = pl1 .outwardNormal ()
2674+ n2 = pl2 .outwardNormal ()
2675+ dt1 = soffit .plane ().outwardNormal ().dot (n1 )
2676+ dt2 = roof .plane ().outwardNormal ().dot (n2 )
2677+ self .assertAlmostEqual (dt1 , 1 , places = 2 )
2678+ self .assertAlmostEqual (dt2 , 1 , places = 2 )
2679+
2680+ # When surfaces are neither parallel nor share any edges (e.g. sloped roof
2681+ # vs horizontal floor), the generated overlap is more likely to hold extra
2682+ # vertices, depending on which surface it is cast onto.
2683+ olap1 = osut .overlap (floor , roof , True )
2684+ olap2 = osut .overlap (roof , floor , True )
2685+ self .assertTrue (osut .areParallel (olap1 , floor ))
2686+ self .assertFalse (osut .areParallel (olap1 , roof ))
2687+ self .assertTrue (osut .areParallel (olap2 , roof ))
2688+ self .assertFalse (osut .areParallel (olap2 , floor ))
2689+ self .assertEqual (len (olap1 ), 3 )
2690+ self .assertEqual (len (olap2 ), 5 )
2691+ area1 = openstudio .getArea (olap1 )
2692+ area2 = openstudio .getArea (olap2 )
2693+ self .assertTrue (area1 )
2694+ self .assertTrue (area2 )
2695+ area1 = area1 .get ()
2696+ area2 = area2 .get ()
2697+ self .assertGreater (area2 - area1 , TOL )
2698+ pl1 = openstudio .Plane (olap1 )
2699+ pl2 = openstudio .Plane (olap2 )
2700+ n1 = pl1 .outwardNormal ()
2701+ n2 = pl2 .outwardNormal ()
2702+ dt1 = floor .plane ().outwardNormal ().dot (n1 )
2703+ dt2 = roof .plane ().outwardNormal ().dot (n2 )
2704+ self .assertAlmostEqual (dt1 , 1 , places = 2 )
2705+ self .assertAlmostEqual (dt2 , 1 , places = 2 )
2706+
26312707 del (model )
26322708 self .assertEqual (o .clean (), DBG )
26332709
0 commit comments