Esempio n. 1
0
def test_repr():
    f = Rational
    blue_ = blue(Rational)
    red_ = red(Rational)
    green_ = green(Rational)

    print blue_, red_, green_
    print Point(f(1), f(2), None)
    print Point(f(1), f(2), blue_)
    print Line(f(1), f(2), f(3), None)
    print Line(f(1), f(2), f(3), blue_)
    print Conic(f(1), f(2), f(3), f(4), f(5), f(6), None)
    print Conic(f(1), f(2), f(3), f(4), f(5), f(6), blue_)
Esempio n. 2
0
 def add_line(self, evt):
     a = self.a.GetValue()
     b = self.b.GetValue()
     c = self.c.GetValue()
     name = self.name.GetValue()
     line = Line(self.field(a), self.field(b), self.field(c),
                 self._get_colour()), name, "o", self.colours.GetValue()
     self.parent.object_panel.add_line(line)
Esempio n. 3
0
def test_construct_quadrance():
    f = FiniteField
    f.base = 37
    geom = blue(f)
    line = Line(f(1), f(1), f(10), geom)
    point = Point(f(0), f(1), geom)

    pl = PointLine(point, line)
    X = pl.construct_quadrance(f(10))

    v = pl.construct_spread(f(1) / f(5))

    N = 20
    for data in generate_fuzz_data(N, pointlines=1, spreads=1):
        pl = data.pointlines[0]
        s = data.spreads[0]
        try:
            ls = pl.construct_quadrance(s)
        except ValueError:
            pass
Esempio n. 4
0
def test_construct_spread():
    f = FiniteField
    f.base = 7
    geom = blue(f)
    line = Line(f(0), f(1), f(0), geom)
    point = Point(f(1), f(2), geom)

    pl = PointLine(point, line)
    v = pl.construct_spread(f(1) / f(5))

    N = 20
    for data in generate_fuzz_data(N, pointlines=1, spreads=1):
        pl = data.pointlines[0]
        s = data.spreads[0]
        if pl.line.null():
            assert_raises(NullLineError, pl.construct_spread, s)
        else:
            try:
                v = pl.construct_spread(s)
            except ValueError:
                pass
Esempio n. 5
0
def random_line(field, geometry):
    a, b, c = field.random(), field.random(), field.random()
    return Line(a, b, c, geometry)