Skip to content

Commit

Permalink
debug options
Browse files Browse the repository at this point in the history
  • Loading branch information
denisri committed Jun 9, 2024
1 parent 71bdd58 commit f39bd0c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion python/catamap/build_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
build_version = 1996
build_version = 2122
13 changes: 9 additions & 4 deletions python/catamap/map_to_meshes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2761,15 +2761,16 @@ def build_depth_wins(self, size=(1000, 1000),
def release_depth_wins(self):
del self.depth_meshes, self.depth_wins

def get_depth(self, pos, view, object_win_size=(8, 8)):
def get_depth(self, pos, view, object_win_size=(8., 8.), verbose=False):
if view is None:
# surface map
return self.ground_altitude(pos)
# pt = objectPositionFromWindow(pos)
pt = aims.Point3df()
ok = view.cursorFromPosition(pos, pt)
if verbose: print('cursorFromPosition', list(pos), ':', ok, pt.np)
if ok and (pt[0] < 0 or pt[0] >= view.width()
or pt[1] < 0 or pt[1] >= view.height()):
if verbose: print('changing camera')
ok = False
if not ok:
tbbmin = pos \
Expand All @@ -2786,8 +2787,10 @@ def get_depth(self, pos, view, object_win_size=(8, 8)):
##view.updateGL()
self.nrenders += 1
ok = view.cursorFromPosition(pos, pt)
if verbose: print('ok:', ok, pt.np)
if ok:
ok = view.positionFromCursor(int(pt[0]), int(pt[1]), pt)
if verbose: print('depth:', ok, pt.np)
if ok:
return pt[2]
# print('get_depth: point not found:', pos, pt)
Expand Down Expand Up @@ -2863,7 +2866,7 @@ def convert_color(color):
def apply_depths(self, meshes):
self.nrenders = 0

object_win_size = (2., 2.)
object_win_size = (20., 20.)
self.build_depth_wins((250, 250))

for main_group, mesh_l in meshes.items():
Expand Down Expand Up @@ -2906,9 +2909,11 @@ def apply_depths(self, meshes):
if alt_colors[1] is not None:
material['border_color'] = alt_colors[1]
for v in mesh.vertex():
if np.isnan(v[0]):
print('NAN in mesh:', mesh.vertex().np)
z = self.get_depth(v, view, object_win_size)
if z is not None:
v[2] += z + hshift
v[2] += z # + hshift # done via transform3d
else:
failed += 1
if debug:
Expand Down

0 comments on commit f39bd0c

Please sign in to comment.