コード例 #1
0
ファイル: test_spline.py プロジェクト: rbianchi66/pyqt_md
 def testAutoLineaChiusa(self):
     pts, spigoli, chiusa = geo2d.xispline(self.linea_chiusa, ams)
     self.assertTrue(chiusa)
     ipts, ix = geo2d.complexSplineX(pts, spigoli, closed=chiusa)
     ilinea = Path(ipts)
     self.assertGeo2dSame(ilinea[0], ilinea[-1])
     self.assertLess(geo2d.pathPathDist(self.linea_chiusa, ilinea), 0.06)
コード例 #2
0
ファイル: test_offset.py プロジェクト: rbianchi66/pyqt_md
    def testInterpola(self):
        """interpola aggiunge i punti per distanza massima 3.0 (bug #3071)."""
        path = geo2d.Path([P(0, 0), P(5, 0), P(10, 0)])
        new_path = geo2d.interpola(path, 3.0)
        self.assertAlmostEqual(geo2d.pathPathDist(new_path, path), 0)

        # La soluzione ottimale per il path prevede 5 punti, quindi se ne sta
        # mettendo di più o di meno sta sbagliando.
        self.assert_(len(new_path) == 5)

        for i_pt, pt in enumerate(new_path):
            if i_pt == 0:
                continue
            self.assert_(geo2d.dist(pt, new_path[i_pt - 1]) < 3.0)