Migrate transpose_from_heitmap

This commit is contained in:
2024-06-16 17:07:38 +02:00
parent ed5d7f85a5
commit b3aba8a97c
17 changed files with 22 additions and 22 deletions

View File

@@ -16,17 +16,6 @@ def handle_import_image(image: Union[str, Image]) -> Image:
return image
def transpose_form_heightmap(heightmap: Union[str, Image], coordinates):
heightmap = handle_import_image(heightmap).convert('L')
editor = Editor()
xMin = (editor.getBuildArea().begin).x
zMin = (editor.getBuildArea().begin).z
return (coordinates[0] + xMin, heightmap.getpixel(
(coordinates[0], coordinates[-1])), coordinates[-1] + zMin)
def simplify_coordinates(coordinates, epsilon):
if len(coordinates) < 3:
return coordinates

Binary file not shown.

Before

Width:  |  Height:  |  Size: 509 B

After

Width:  |  Height:  |  Size: 505 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 439 B

After

Width:  |  Height:  |  Size: 387 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 989 B

After

Width:  |  Height:  |  Size: 942 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 824 B

After

Width:  |  Height:  |  Size: 817 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 469 B

After

Width:  |  Height:  |  Size: 359 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

View File

@@ -299,3 +299,12 @@ def rectangle_2D_to_3D(rectangle: list[tuple[tuple[int, int], tuple[int, int]]],
new_rectangle.append(
((start[0], avg_height, start[1]), (end[0], avg_height + randint(height_min, height_max), end[1])))
return new_rectangle
def transpose_form_heightmap(heightmap: Union[str, Image], coordinates, origin: tuple[int, int]) -> tuple[int, int, int]:
heightmap = handle_import_image(heightmap).convert('L')
xMin, zMin = origin
return (coordinates[0] + xMin, heightmap.getpixel(
(coordinates[0], coordinates[-1])), coordinates[-1] + zMin)

View File