Skip to content

Commit

Permalink
Inside view: factoring out graph_trace algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
unhyperbolic committed Apr 19, 2024
1 parent a01bd7d commit 25121a4
Showing 1 changed file with 27 additions and 19 deletions.
46 changes: 27 additions & 19 deletions python/raytracing/raytracing_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,36 +82,44 @@ def get_compile_time_constants(self):
d[b'##num_edges##'] = len(self.mcomplex.Edges)
return d

def update_view_state(self, boost_tet_num_and_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 = matrix(boost, ring=self.RF)
m = matrix(m, ring=self.RF)
m = matrix(m, ring=self.RF)

boost = O13_orthonormalise(boost * m)
boost, tet, weight = _graph_trace(
boost * m, self.mcomplex.Tetrahedra[tet_num], weight)

entry_F = -1
return boost, tet.Index, weight

for i in range(100):
pos = boost.transpose()[0]
tet = self.mcomplex.Tetrahedra[tet_num]
def _graph_trace(boost, tet, weight):

amount, F = max(
[ (r13_dot(pos, tet.R13_planes[F]), F)
for F in t3m.TwoSubsimplices ])
boost = O13_orthonormalise(boost)

if F == entry_F:
break
if amount < 0.0000001:
break
entry_face = 0

boost = O13_orthonormalise(tet.O13_matrices[F] * boost)
tet_num = tet.Neighbor[F].Index
entry_F = tet.Gluing[F].image(F)
weight += tet.Weights[F]
for i in range(100):
pos = boost.transpose()[0]

signed_dist, face = max(
[ (r13_dot(pos, tet.R13_planes[face]), face)
for face in t3m.TwoSubsimplices ])

if face == entry_face:
break
if signed_dist < 0.0000001:
break

boost = O13_orthonormalise(tet.O13_matrices[face] * boost)
weight += tet.Weights[face]
entry_face = tet.Gluing[face].image(face)
tet = tet.Neighbor[face]

return boost, tet, weight

return boost, tet_num, weight

0 comments on commit 25121a4

Please sign in to comment.