diff --git a/python/raytracing/eyeball.py b/python/raytracing/eyeball.py index 318ef85a..c1c4f3a2 100644 --- a/python/raytracing/eyeball.py +++ b/python/raytracing/eyeball.py @@ -9,6 +9,10 @@ import math +eyeball_type_none = 0 +eyeball_type_paper_plane = 1 +eyeball_type_eyeball = 2 + _max_num_eyeballs = 40 class Eyeball: @@ -25,7 +29,7 @@ def __init__(self, raytracing_view): def _enabled(self): return ( self.raytracing_view.ui_parameter_dict['eyeballSize'][1] > 0 and - self.raytracing_view.ui_parameter_dict['eyeballType'][1] > 0) + self.raytracing_view.ui_parameter_dict['eyeballType'][1] > eyeball_type_none) def get_compile_time_defs(self): if not self._enabled(): @@ -62,7 +66,7 @@ def get_uniform_bindings(self): min_inner_product = -RF(1.0 + 1e-7) eyeballRadius = self.raytracing_view.ui_parameter_dict['eyeballSize'][1] - if self.raytracing_view.ui_parameter_dict['eyeballType'][1] == 2: + if self.raytracing_view.ui_parameter_dict['eyeballType'][1] == eyeball_type_eyeball: eyeballRadius = eyeballRadius / 2.0 tets_to_data = [ [] for i in range(self.num_tetrahedra) ] diff --git a/python/raytracing/ideal_raytracing_data.py b/python/raytracing/ideal_raytracing_data.py index 4b079a4a..08bfbc3e 100644 --- a/python/raytracing/ideal_raytracing_data.py +++ b/python/raytracing/ideal_raytracing_data.py @@ -392,15 +392,14 @@ def initial_view_state(self): weight = 0.0 return (boost, tet_num, weight) -# def update_view_state(self, boost_tet_num_and_weight, -# m=matrix([[1.0, 0.0, 0.0, 0.0], -# [0.0, 1.0, 0.0, 0.0], -# [0.0, 0.0, 1.0, 0.0], -# [0.0, 0.0, 0.0, 1.0]])): -# boost, tet_num, weight = boost_tet_num_and_weight -# boost = boost * m -# return boost, tet_num, weight - + def update_view_state(self, boost_tet_num_and_weight, + m=matrix([[1.0, 0.0, 0.0, 0.0], + [0.0, 1.0, 0.0, 0.0], + [0.0, 0.0, 1.0, 0.0], + [0.0, 0.0, 0.0, 1.0]])): + boost, tet_num, weight = boost_tet_num_and_weight + boost = boost * m + return boost, tet_num, weight def _pgl2_matrix_for_face(tet, F): gluing = tet.Gluing[F] diff --git a/python/raytracing/inside_viewer.py b/python/raytracing/inside_viewer.py index 7a3c6282..e6670f49 100644 --- a/python/raytracing/inside_viewer.py +++ b/python/raytracing/inside_viewer.py @@ -10,6 +10,7 @@ from .geodesics_window import GeodesicsWindow from .hyperboloid_utilities import unit_3_vector_and_distance_to_O13_hyperbolic_translation from .zoom_slider import Slider, ZoomSlider +from .eyeball import eyeball_type_none, eyeball_type_paper_plane, eyeball_type_eyeball try: from math import gcd as _gcd @@ -350,9 +351,12 @@ def create_eyeball_frame(self, parent): self_type_label.grid(row=row, column=0) radio_buttons = [] - for i, text in enumerate(["None", "Paper plane", "Eyeball"]): + for i, (eyeball_type, text) in enumerate([ + (eyeball_type_none, "None"), + (eyeball_type_paper_plane, "Paper plane"), + (eyeball_type_eyeball, "Eyeball")]): button = ttk.Radiobutton(frame, - value=i, + value=eyeball_type, text=text, takefocus=0) button.grid(row=row, column=1 + i, padx=8, sticky=tkinter.NW) diff --git a/python/raytracing/raytracing_view.py b/python/raytracing/raytracing_view.py index ee4a913c..ef535ccf 100644 --- a/python/raytracing/raytracing_view.py +++ b/python/raytracing/raytracing_view.py @@ -4,6 +4,7 @@ from .hyperboloid_navigation import * from .geodesics import Geodesics from .eyeball import Eyeball +from .eyeball import eyeball_type_none, eyeball_type_paper_plane from . import shaders from snappy.CyOpenGL import SimpleImageShaderWidget @@ -127,7 +128,7 @@ def __init__(self, 'geodesicTubeEnables' : ['bool[]', []], 'eyeballSize' : ['float', 0.5], 'freezeEyeball' : ['bool', False], - 'eyeballType' : ['int', 0 if has_weights else 1] + 'eyeballType' : ['int', eyeball_type_none if has_weights else eyeball_type_paper_plane] } if cohomology_class: