Matthew Turk avatar Matthew Turk committed f8f64e4

For high precision calculations, we want to apply bounding box estimates before
casting to float32 in the PLY export in AMRSurface.

Comments (0)

Files changed (1)

yt/data_objects/data_containers.py

         else:
             arr = np.empty(nv/3, np.dtype(fs[:-3]))
         for i, ax in enumerate("xyz"):
-            v[ax][:] = self.vertices[i,:]
-            np.subtract(v[ax][:], bounds[i][0], v[ax][:])
+            # Do the bounds first since we cast to f32
+            tmp = self.vertices[i,:]
+            np.subtract(tmp, bounds[i][0], tmp)
             w = bounds[i][1] - bounds[i][0]
-            np.divide(v[ax][:], w, v[ax][:])
-            np.subtract(v[ax][:], 0.5, v[ax][:]) # Center at origin.
+            np.divide(tmp, w, tmp)
+            np.subtract(tmp, 0.5, tmp) # Center at origin.
+            v[ax][:] = tmp 
         f.write("end_header\n")
         v.tofile(f)
         arr["ni"][:] = 3
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.