Ejemplo n.º 1
0
 def setUp(self):
     clipper.SCALING_FACTOR = 1
     self.pc = clipper.Pyclipper()
     self.add_default_paths(self.pc)
     self.default_args = [
         clipper.CT_INTERSECTION, clipper.PFT_EVENODD, clipper.PFT_EVENODD
     ]
Ejemplo n.º 2
0
    def test_exact_results(self):
        """
        Test whether coordinates passed into the library are returned
        exactly, if they are not affected by the operation.
        """

        pc = clipper.Pyclipper()

        # Some large triangle.
        paths = [[[0, 1], [0, 0], [15**15, 0]]]

        pc.AddPaths(paths, clipper.PT_SUBJECT, True)
        result = pc.Execute(clipper.PT_CLIP, clipper.PFT_EVENODD,
                            clipper.PFT_EVENODD)

        self.assertEqual(result, paths)
Ejemplo n.º 3
0
 def setUp(self):
     clipper.SCALING_FACTOR = 2.
     self.pc = clipper.Pyclipper()
Ejemplo n.º 4
0
 def test_execute_empty(self):
     pc = clipper.Pyclipper()
     with self.assertRaises(clipper.ClipperException):
         pc.Execute(clipper.CT_UNION, clipper.PFT_NONZERO,
                    clipper.PFT_NONZERO)
Ejemplo n.º 5
0
 def test_clipper_properties(self):
     pc = clipper.Pyclipper()
     for prop_name in ('ReverseSolution', 'PreserveCollinear',
                       'StrictlySimple'):
         self.check_property_assignment(pc, prop_name, [True, False])