def test_ellipse_mode_success( vsk: vsketch.Vsketch, data: Tuple[float, float, float, float], mode: str, expected: Tuple[float, float, float, float], ) -> None: vsk.detail(0.01) vsk.ellipse(*data, mode=mode) assert line_count_equal(vsk, 1) assert bounds_equal(vsk, *expected)
def test_arc_close_success( vsk: vsketch.Vsketch, data: Tuple[float, float, float, float, float, float], close: str, expected: Sequence[float], ) -> None: vsk.detail(0.01) vsk.arc(*data, close=close) assert line_count_equal(vsk, 1) assert bounds_equal(vsk, *expected)
def draw(self, vsk: vsketch.Vsketch) -> None: vsk.size("a5", landscape=True) vsk.scale("1.5cm") vsk.detail(self.detail_value) vsk.circle(0, 0, 1) vsk.circle(0, 0, 2) with vsk.pushMatrix(): vsk.scale(4) # the scale is taken into account to compute details vsk.circle(0, 0, 1) vsk.translate(4, 0) for i in range(-4, 5): with vsk.pushMatrix(): vsk.translate(0, i * 0.4) vsk.bezier(0, 0, 1, -2, 2, 2, 3, 0)
def test_ellipse_default_success(vsk: vsketch.Vsketch) -> None: vsk.detail(0.01) vsk.ellipse(2, 2, 1, 2) assert line_count_equal(vsk, 1) assert bounds_equal(vsk, 1.5, 1, 2.5, 3)
def test_arc_default_success(vsk: vsketch.Vsketch) -> None: vsk.detail(0.01) vsk.arc(2, 2, 1, 3, 0, np.pi) assert line_count_equal(vsk, 1) assert bounds_equal(vsk, 1.5, 0.5, 2.5, 2)
def test_circle_default(vsk: vsketch.Vsketch) -> None: # default should be diameter vsk.detail(0.01) # make sure we have a tight bound match vsk.circle(0, 0, 5) assert line_count_equal(vsk, 1) assert bounds_equal(vsk, -2.5, -2.5, 2.5, 2.5)