From 0e5e6a931309a06f43a301a4dae4f5fb6f446a91 Mon Sep 17 00:00:00 2001 From: Xeon0X Date: Sat, 20 Apr 2024 17:12:53 +0200 Subject: [PATCH] Add working curve --- main.py | 9 +++++++-- networks/curve.py | 5 ----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/main.py b/main.py index 9dc0144..1f43c45 100644 --- a/main.py +++ b/main.py @@ -2,7 +2,7 @@ from gdpc import Editor, Block, geometry import networks.curve as curve import numpy as np -# editor = Editor(buffering=True) +editor = Editor(buffering=True) # # Get a block # block = editor.getBlock((0,48,0)) @@ -13,5 +13,10 @@ import numpy as np # # Build a cube # geometry.placeCuboid(editor, (458, 92, 488), (468, 99, 471), Block("oak_planks")) -curve = curve.Curve([(0, 0, 0), (1, 1, 1), (5, 5, 5), (1, 1, 1), (1, 1, 1)]) +curve = curve.Curve([(396, 132, 740), (435, 138, 730), + (443, 161, 758), (417, 73, 729)]) curve.compute_curve() + +for point in curve.computed_points: + print(point) + editor.placeBlock(point, Block("stone")) diff --git a/networks/curve.py b/networks/curve.py index dfe39c2..01f0c89 100644 --- a/networks/curve.py +++ b/networks/curve.py @@ -1,6 +1,5 @@ import numpy as np from scipy import interpolate -from scipy.interpolate import interp1d class Curve: @@ -22,7 +21,6 @@ class Curve: # Remove duplicates. Curve can't intersect itself points = tuple(map(tuple, np.array(self.target_points))) points = sorted(set(points), key=points.index) - print(points) # Change coordinates structure to (x1, x2, x3, ...), (y1, y2, y3, ...) (z1, z2, z3, ...) coords = np.array(points, dtype=np.float32) @@ -42,6 +40,3 @@ class Curve: self.computed_points = [(x, y, z) for x, y, z in zip( x_rounded, y_rounded, z_rounded)] - - for i in range(len(self.computed_points)): - print(self.computed_points[i])