def test_center01(self): f = Facet([ R3(0.0, 0.0, 0.0), R3(2.0, 0.0, 0.0), R3(2.0, 2.0, 0.0), R3(0.0, 2.0, 0.0) ]) assert f.center().approx((R3(1.0, 1.0, 0.0)))
def test_v_normal02(self): f = Facet([ R3(0.0, 0.0, 0.0), R3(2.0, 0.0, 0.0), R3(2.0, 2.0, 0.0), R3(0.0, 2.0, 0.0) ]) normals = [ R3(-1.0, 0.0, 0.0), R3(0.0, -1.0, 0.0), R3(1.0, 0.0, 0.0), R3(0.0, 1.0, 0.0) ] for t in zip(f.v_normals(), normals): assert t[0].is_collinear(t[1])
def test_shadow_03(self): s = Edge(R3(0.0, 0.0, -1.0), R3(1.0, 1.0, -1.0)) f = Facet([ R3(0.0, 0.0, 0.0), R3(2.0, 0.0, 0.0), R3(2.0, 2.0, 0.0), R3(0.0, 2.0, 0.0) ]) s.shadow(f) assert len(s.gaps) == 0
def test_shadow_02(self): s = Edge(R3(0.0, 0.0, 1.0), R3(1.0, 1.0, 1.0)) f = Facet([ R3(0.0, 0.0, 0.0), R3(2.0, 0.0, 0.0), R3(2.0, 2.0, 0.0), R3(0.0, 2.0, 0.0) ]) s.shadow(f) assert s.gaps[0].approx(Segment(0.0, 1.0))
def test_h_normal03(self): f = Facet([R3(1.0, 0.0, 0.0), R3(0.0, 1.0, 0.0), R3(0.0, 0.0, 1.0)]) assert f.h_normal().is_collinear(R3(1.0, 1.0, 1.0))
def test_vertical02(self): f = Facet([R3(0.0, 0.0, 0.0), R3(0.0, 0.0, 1.0), R3(1.0, 0.0, 0.0)]) assert f.is_vertical()
def test_vertical01(self): f = Facet([R3(0.0, 0.0, 0.0), R3(3.0, 0.0, 0.0), R3(0.0, 3.0, 0.0)]) assert not f.is_vertical()