[yt-svn] commit/yt: MatthewTurk: Add a property to AMRSurface to get back Triangles

Bitbucket commits-noreply at bitbucket.org
Wed Jan 23 06:48:53 PST 2013


1 new commit in yt:

https://bitbucket.org/yt_analysis/yt/commits/41d7241cdc15/
changeset:   41d7241cdc15
branch:      yt
user:        MatthewTurk
date:        2013-01-23 15:48:00
summary:     Add a property to AMRSurface to get back Triangles
affected #:  1 file

diff -r a0f7a5f857189b4cea206d7c0ad019e08c6a50c3 -r 41d7241cdc1539578fbb679c84ed5a0b98609926 yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py
+++ b/yt/data_objects/data_containers.py
@@ -4381,6 +4381,16 @@
         return march_cubes_grid_flux(self.field_value, vals, xv, yv, zv,
                     ff, mask, grid.LeftEdge, grid.dds)
 
+    @property
+    def triangles(self):
+        if self.vertices is None:
+            self.get_data()
+        vv = np.empty((self.vertices.shape[1]/3, 3, 3), dtype="float64")
+        for i in range(3):
+            for j in range(3):
+                vv[:,i,j] = self.vertices[j,i::3]
+        return vv
+
     def export_ply(self, filename, bounds = None, color_field = None,
                    color_map = "algae", color_log = True, sample_type = "face"):
         r"""This exports the surface to the PLY format, suitable for visualization

Repository URL: https://bitbucket.org/yt_analysis/yt/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.



More information about the yt-svn mailing list