Exemple #1
0
def test_fuzz_bisect():
    N = 50

    for data in generate_fuzz_data(N, lines=2):
        l1, l2 = data.lines
        if l1.null() or l2.null() or Vertex(l1, l2).parallel() or Vertex(l1, l2).point.null():
            continue

        V = l1.vector()
        U = l2.vector()
        try:
            (U.norm()/V.norm()).sqrt()
        except ValueError:
            continue

        v0 = Vertex(l1, l2)
        bisectors = v0.bisect()
        s0 = v0.spread()

        s1 = Vertex(l1, bisectors.line1).spread()
        s2 = Vertex(l1, bisectors.line2).spread()
        s3 = Vertex(l2, bisectors.line1).spread()
        s4 = Vertex(l2, bisectors.line2).spread()
                
        assert bisectors.spread() == 1
Exemple #2
0
    def add_grammola(self, evt):
        k = self.k.GetValue()
        l1 = self._get_line(self.lines1)
        l2 = self._get_line(self.lines2)

        if l1 and l2:
            vertex = Vertex(l1, l2)
            name = self.name.GetValue()
            grammola = vertex.grammola(k), name, "x", self.colours.GetValue()
            self.parent.object_panel.add_conic(grammola)