Skip to content

Commit

Permalink
Fix crop mouse mode in VR with tilted slab volume. Bug #10206
Browse files Browse the repository at this point in the history
  • Loading branch information
tomgoddard committed Nov 22, 2023
1 parent 1b12cfa commit 28be708
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/bundles/map/src/moveplanes.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,13 @@ def _choose_box_face(self, line):

ro = v.rendering_options
if ro.image_mode == 'tilted slab':
cpos = v.session.main_view.camera.position
sx,sy,sz = cpos.inverse().transform_vector(ro.tilted_slab_axis) # Slab axis in camera coords
self._slab_side = 0 if sz <= 0 else 1
saxis = v.scene_position * ro.tilted_slab_axis # Slab axis in scene coords
from chimerax.geometry import inner_product
dir = inner_product(saxis, line[1] - line[0])
self._slab_side = 0 if dir >= 0 else 1
self._pixel_size = ps = self.session.main_view.pixel_size(v.scene_position * v.center())
cpos = v.session.main_view.camera.position
sx,sy,sz = cpos.inverse().transform_vector(saxis) # Slab axis in camera coords
from math import sqrt
sn = sqrt(sx*sx + sy*sy)
self._slab_dir = (ps*sx/sn, ps*sy/sn) if sn > 0 else (0,1)
Expand Down

0 comments on commit 28be708

Please sign in to comment.