diff --git a/ShipGen/Generate.py b/ShipGen/Generate.py index bd067e7..321ce90 100644 --- a/ShipGen/Generate.py +++ b/ShipGen/Generate.py @@ -82,6 +82,10 @@ def mesh_to_triangles(mesh:Mesh) -> np.ndarray: def mesh_list_to_triangles(mesh_list:list[Mesh]) -> list[np.ndarray]: return list(map(mesh_to_triangles, mesh_list)) +def normalize_x(mesh:Mesh, scale:float = 10): + mesh.vectors -= np.array([mesh.min_[0], 0, 0]) + mesh.vectors *= scale / (mesh.max_[0] - mesh.min_[0]) + def load_data(): # Load in the Data: diff --git a/ShipGen/__init__.py b/ShipGen/__init__.py index 46692fc..1d07d5d 100644 --- a/ShipGen/__init__.py +++ b/ShipGen/__init__.py @@ -3,4 +3,5 @@ ShipCharacteristics, mesh_to_triangles, mesh_list_to_triangles, + normalize_x, ) \ No newline at end of file