示例#1
0
 def test_simplify(self):
     slice1 = SVMTK.Slice()
     slice1.add_constraint(
         [SVMTK.Point_2(0, 0),
          SVMTK.Point_2(1, 1),
          SVMTK.Point_2(2, 1)])
     slice1.simplify(1.0)
     constraints = slice1.get_constraints()
     self.assertEqual(len(constraints[0]), 3)
示例#2
0
 def test_slice_add_constrains(self):
     slice1 = SVMTK.Slice()
     slice1.add_constraint([SVMTK.Point_2(0, 0), SVMTK.Point_2(1, 1)])
     self.assertTrue(slice1.number_of_constraints(), 1)
     slice2 = SVMTK.Slice(SVMTK.Plane_3(0., 0., 1., 0.))
     slice2.add_constraint(
         [SVMTK.Point_2(0.5, 0.5),
          SVMTK.Point_2(0.5, -0.5)])
     slice3 = SVMTK.Slice(slice2)
     slice3.add_constraints(slice1)
     self.assertTrue(slice3.number_of_constraints(), 2)
示例#3
0
    def test_simple_cgal_wrappers(self):
        p3 = SVMTK.Point_3(1., 0, 1.0)
        self.assertEqual(p3.x(), 1.0)
        self.assertEqual(p3.y(), 0.0)
        self.assertEqual(p3.z(), 1.0)
        p2 = SVMTK.Point_2(0, 1.)
        self.assertEqual(p2.x(), 0)
        self.assertEqual(p2.y(), 1.0)
        pl3 = SVMTK.Plane_3(1, 2, 3, 4)
        self.assertEqual(pl3.a(), 1.0)
        self.assertEqual(pl3.b(), 2.0)
        self.assertEqual(pl3.c(), 3.0)
        self.assertEqual(pl3.d(), 4.0)

        v3 = SVMTK.Vector_3(0, 1.0, 0.0)
        self.assertEqual(v3.x(), 0.0)
        self.assertEqual(v3.y(), 1.0)
        self.assertEqual(v3.z(), 0.0)

        pl3 = SVMTK.Plane_3(p3, v3)
        self.assertEqual(pl3.a(), 0.0)
        self.assertEqual(pl3.b(), 1.0)
        self.assertEqual(pl3.c(), 0.0)
        self.assertEqual(pl3.d(), 0.0)