Skip to content

Commit

Permalink
Insider viewer: make face boundary thickness actually be in hyperboli…
Browse files Browse the repository at this point in the history
…c units.
  • Loading branch information
unhyperbolic committed Nov 25, 2023
1 parent 6409ba8 commit 2286237
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
7 changes: 4 additions & 3 deletions python/raytracing/inside_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ def create_skeleton_frame(self, parent):

UniformDictController.create_horizontal_scale(
frame,
self.widget.ui_uniform_dict,
self.widget.ui_parameter_dict,
key='edgeThickness',
title='Face boundary thickness',
row=row,
Expand All @@ -440,7 +440,7 @@ def create_skeleton_frame(self, parent):
left_end=0.0,
right_end=1.25,
update_function=self.widget.recompute_raytracing_data_and_redraw,
format_string='%.2f'))
format_string='%.3f'))
row += 1

self.edgeTubeRadiusController = (
Expand All @@ -452,7 +452,8 @@ def create_skeleton_frame(self, parent):
row=row,
left_end=0.0,
right_end=0.2,
update_function=self.widget.redraw_if_initialized))
update_function=self.widget.redraw_if_initialized,
format_string='%.3f'))
row += 1

label = ttk.Label(frame, text="Edge colors", padding=gui_utilities.label_pad)
Expand Down
4 changes: 3 additions & 1 deletion python/raytracing/raytracing_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ def __init__(self,
'maxSteps' : ['int', 99 if has_weights else 40],
'maxDist' : ['float', 6.5 if has_weights else 17.0],
'subpixelCount': ['int', 1],
'edgeThickness' : ['float', 0.0000001],

'contrast' : ['float', 0.1 if has_weights else 0.5],
'noGradient' : ['bool', False],
Expand All @@ -121,6 +120,7 @@ def __init__(self,
self.ui_parameter_dict = {
'insphere_scale' : ['float', 0.0 ],
'cuspAreas' : ['float[]', manifold.num_cusps() * [ 0.0 if has_weights else 1.0 ]],
'edgeThickness' : ['float', 0.0],
'edgeTubeRadius' : ['float', 0.0 if has_weights else
(0.025 if trig_type == 'finite' else 0.0)],
'vertexRadius' : ['float', 0.0 if has_weights else 0.25],
Expand Down Expand Up @@ -194,6 +194,8 @@ def get_uniform_bindings(self, width, height):
'viewMode' : ('int', self.view),
'edgeTubeRadiusParam' :
('float', math.cosh(self.ui_parameter_dict['edgeTubeRadius'][1]) ** 2 / 2.0),
'edgeThicknessParam' :
('float', math.sinh(self.ui_parameter_dict['edgeThickness'][1]) ** 2),
'vertexSphereRadiusParam' :
('float', math.cosh(self.ui_parameter_dict['vertexRadius'][1]) ** 2)
},
Expand Down
6 changes: 3 additions & 3 deletions python/raytracing/shaders/fragment.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ uniform float currentWeight;
uniform int maxSteps;
uniform float maxDist;
uniform int subpixelCount;
uniform float edgeThickness;
uniform float edgeThicknessParam;
uniform float contrast;

const int perspectiveTypeMaterial = 0;
Expand Down Expand Up @@ -1034,11 +1034,11 @@ ray_trace_through_hyperboloid_tet(inout RayHit ray_hit)
ray_hit.dist += atanh(smallest_p);
advanceRayByDistParam(ray_hit.ray, smallest_p);

if(edgeThickness > 0.00001) {
if(edgeThicknessParam > 0.00001) {
if (ray_hit.object_type == object_type_face) {
if (!traceInsideVertexNeighborhood() ||
smallest_p > horosphere_exit_param) {
if(triangleBdryParam(ray_hit.ray.point, ray_hit.tet_num, ray_hit.object_index) < edgeThickness) {
if(triangleBdryParam(ray_hit.ray.point, ray_hit.tet_num, ray_hit.object_index) < edgeThicknessParam) {
ray_hit.object_type = object_type_edge_fan;
}
}
Expand Down

0 comments on commit 2286237

Please sign in to comment.