Ejemplo n.º 1
0
def test_side_of1():
    l=Line(Vertex(0,0),Vertex(10,0))    
    assert l.side_of_extrapolated_line(Vertex(5,5))==-1
    assert l.side_of_extrapolated_line(Vertex(5,-5))==1
    assert l.side_of_extrapolated_line(Vertex(15,5))==-1
    assert l.side_of_extrapolated_line(Vertex(15,-5))==1
    assert l.side_of_extrapolated_line(Vertex(-5,5))==-1
    assert l.side_of_extrapolated_line(Vertex(-5,-5))==1
    assert l.side_of_extrapolated_line(Vertex(-5,0))==0
    assert l.side_of_extrapolated_line(Vertex(5,0))==0
    assert l.side_of_extrapolated_line(Vertex(15,0))==0
    r=Line(Vertex(10,0),Vertex(0,0))    
    assert r.side_of_extrapolated_line(Vertex(5,5))==1
    assert r.side_of_extrapolated_line(Vertex(5,-5))==-1
Ejemplo n.º 2
0
def test_side_of3():    
    l=Line(Vertex(0,0),Vertex(1,1000000))
    assert l.side_of_extrapolated_line(Vertex(1000000,0))==1
    assert l.side_of_extrapolated_line(Vertex(-1000000,0))==-1
    assert l.side_of_extrapolated_line(Vertex(0,100000))==0
    assert l.side_of_extrapolated_line(Vertex(1000000,2000000))==1
Ejemplo n.º 3
0
def test_side_of2():    
    l=Line(Vertex(0,0),Vertex(1,10))
    assert l.side_of_extrapolated_line(Vertex(0,10))==-1
    assert l.side_of_extrapolated_line(Vertex(1,0))==1
    assert l.side_of_extrapolated_line(Vertex(1,8))==0
    assert l.side_of_extrapolated_line(Vertex(0,2))==0