Spaces:
Sleeping
Sleeping
Stephen
commited on
Commit
·
85773e1
1
Parent(s):
98a9747
corrected centring
Browse files- sdf_export.py +5 -3
sdf_export.py
CHANGED
@@ -12,10 +12,12 @@ def mesh_to_sdf_glsl(path, resolution=32):
|
|
12 |
print(f" Bounds: {mesh.bounds}")
|
13 |
print(f" Extents: {mesh.extents}")
|
14 |
|
15 |
-
# Center the mesh
|
16 |
-
|
|
|
|
|
17 |
print(f"\nAfter centering:")
|
18 |
-
print(f"
|
19 |
print(f" Bounds: {mesh.bounds}")
|
20 |
print(f" Extents: {mesh.extents}")
|
21 |
|
|
|
12 |
print(f" Bounds: {mesh.bounds}")
|
13 |
print(f" Extents: {mesh.extents}")
|
14 |
|
15 |
+
# Center the mesh properly in all dimensions
|
16 |
+
bounds = mesh.bounds
|
17 |
+
center = (bounds[0] + bounds[1]) / 2.0
|
18 |
+
mesh.vertices -= center
|
19 |
print(f"\nAfter centering:")
|
20 |
+
print(f" Center: {center}")
|
21 |
print(f" Bounds: {mesh.bounds}")
|
22 |
print(f" Extents: {mesh.extents}")
|
23 |
|