Skip to content

Commit

Permalink
Added normalize function
Browse files Browse the repository at this point in the history
Added function to normalize the scale of meshes
  • Loading branch information
JoeBell committed Mar 9, 2025
1 parent e685ab2 commit 4acc015
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ShipGen/Generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
1 change: 1 addition & 0 deletions ShipGen/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
ShipCharacteristics,
mesh_to_triangles,
mesh_list_to_triangles,
normalize_x,
)

0 comments on commit 4acc015

Please sign in to comment.