Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Streamlined 3d viewer by removing extraneous code
  • Loading branch information
daminton committed Feb 23, 2022
1 parent bc52cba commit ed8cac8
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions python/ctem/ctem/viewer3d.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
import numpy as np
import os
import open3d
import ctem
import os

class Polysurface(ctem.Simulation):
"""A model of a self-gravitating small body"""
def __init__(self):
ctem.Simulation.__init__(self, isnew=False) # Initialize the data structures, but doesn't start a new run
#used for Open3d module
self.mesh = open3d.geometry.TriangleMesh()
self.process_interval(isnew=False)
return

def ctem2blockmesh(self):
Expand Down Expand Up @@ -94,7 +91,6 @@ def ctem2trimesh(self):
for j in range(s - 1):
for i in range(s - 1):
idx = (s - 1) * j + i
# faces[idx,:] = [ j*s+i, j*s+i+1, (j+1)*s+i+1, (j+1)*s+i ]
faces[idx, :] = [j * s + i, j * s + i + 1, (j + 1) * s + i + 1]
idx += (s - 1) ** 2
faces[idx, :] = [(j + 1) * s + i + 1, (j + 1) * s + i, j * s + i ]
Expand All @@ -112,19 +108,12 @@ def visualize(self):
opt = vis.get_render_option()
opt.background_color = np.asarray([0, 0, 0])

# zmax = np.amax(self.surface_dem)
# zmin = np.amin(self.surface_dem)
# cnorm = (self.surface_dem.flatten() - zmin) / (zmax - zmin)
# cval = plt.cm.terrain(cnorm)[:, :3]

self.mesh.paint_uniform_color([0.5, 0.5, 0.5])
vis.run()
vis.destroy_window()


if __name__ == '__main__':
import matplotlib.pyplot as plt

sim = Polysurface()
sim.ctem2trimesh()
sim.visualize()
Expand Down

0 comments on commit ed8cac8

Please sign in to comment.