commit b2ff18e76d019fdfaeb05f12501bd4d869a64856 Author: Marcus Nordstrom Date: Wed May 28 21:04:22 2025 +0200 feat: add oceans sketch diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..908cd57 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*.pyc +.venv +*.bin \ No newline at end of file diff --git a/config/Ocean_1.json b/config/Ocean_1.json new file mode 100644 index 0000000..2ad4921 --- /dev/null +++ b/config/Ocean_1.json @@ -0,0 +1 @@ +{"num_line": 80, "y_offset": 17.0, "x_freq": 0.32000000000000006, "y_freq": 25, "tilt": -45, "move_x": 150.0, "move_y": 0.0, "move_z": 60.0, "__seed__": 592569843} \ No newline at end of file diff --git a/ocean.py b/ocean.py new file mode 100644 index 0000000..dfa3948 --- /dev/null +++ b/ocean.py @@ -0,0 +1,36 @@ +import numpy as np +import vsketch +from vpype import UNITS + +class Ocean(vsketch.SketchClass): + num_line = vsketch.Param(100, 1) + y_offset = vsketch.Param(19.0) + x_freq = vsketch.Param(0.25) + y_freq = vsketch.Param(18) + tilt = vsketch.Param(-45, -90, 90) + move_x = vsketch.Param(200.0, -1000, 1000) + move_y = vsketch.Param(0.0, -1000, 1000) + move_z = vsketch.Param(60.0, -1000, 1000) + + def draw(self, vsk: vsketch.Vsketch) -> None: + vsk.size("a4", landscape=True) + vsk.scale("cm") + #vsk.penWidth(0.1) + x_coords = np.linspace(0, 25, 1000) + + perlin = vsk.noise( + x_coords * self.x_freq, np.arange(self.num_line) / self.num_line * self.y_freq + ) + + for i in range(self.num_line): + y_coords = perlin[:, i] + self.y_offset / self.num_line * i + vsk.polygon(x_coords, y_coords) + + vsk.vpype(f"perspective --move {self.move_x} {self.move_y} {self.move_z} --tilt {self.tilt}") + + def finalize(self, vsk: vsketch.Vsketch) -> None: + vsk.vpype("linemerge linesimplify reloop linesort") + + +if __name__ == "__main__": + Ocean.display() \ No newline at end of file diff --git a/output/ocean_liked_1.svg b/output/ocean_liked_1.svg new file mode 100644 index 0000000..8bfba1e --- /dev/null +++ b/output/ocean_liked_1.svg @@ -0,0 +1,94 @@ + + + + + + image/svg+xml + Vsketch with params {'__seed__': 592569843, 'num_line': 80, 'y_offset': 17.0, 'x_freq': 0.32000000000000006, 'y_freq': 25, 'tilt': -45, 'move_x': 150.0, 'move_y': 0.0, 'move_z': 60.0} + 2025-05-28T20:29:35.155817 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..9f5f49c --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +vsketch +vpype-perspective +PyQT5 \ No newline at end of file