def test_smoothed_pins_endpoints(self): points = ((50,50,50),) + ((20,20,20),) * 7 + ((80,80,80),) stroke = Stroke(*points) smoothed = stroke.smoothed() self.assertEqual( smoothed.points[0], (50,50,50) ) self.assertEqual( smoothed.points[-1], (80,80,80) )
def test_smoothed_equal_points(self): points = [ (1,1,1) ] * 7 stroke = Stroke(*points) smoothed = stroke.smoothed() self.assertEqual(smoothed.points, points)
def test_smoothed_with_blending(self): points = [ (1,1,1), (0,0,0) ] * 4 stroke = Stroke(*points) smoothed = stroke.smoothed() self.assertTrue( smoothed.points[1][0] > 0 ) self.assertTrue( smoothed.points[2][0] < 1 )
def test_smoothed_too_few_points(self): stroke = Stroke((4,4,4),(1,1,1),(4,4,4)) smoothed = stroke.smoothed() self.assertEqual(smoothed.points, [(4,4,4),(1,1,1),(4,4,4)])