Skip to content

Commit

Permalink
fix: implementation of inside
Browse files Browse the repository at this point in the history
fix: typo
  • Loading branch information
BillHuang2001 committed Oct 11, 2023
1 parent 6f16b36 commit dc562ca
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/evox/problems/numerical/maf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
@jit
def inside(x, a, b):
"""check if x is in [a, b] or [b, a]"""
return (a <= x <= b) | (b <= x <= a)
return (jnp.minimum(a, b) <= x) & (x <= jnp.maximum(a, b))


@jit
Expand All @@ -33,7 +33,7 @@ def ray_intersect_segment(point, seg_init, seg_term):
judge_2 = (LHS >= RHS) ^ (y_dist < 0)
# check intersection_y, which is P_y is inside the segment
judge_3 = inside(point[1], seg_init[1], seg_term[1])
return ((y_dist == 0) & judge_1) | (y_dist != 0 & judge_2 & judge_3)
return ((y_dist == 0) & judge_1) | ((y_dist != 0) & judge_2 & judge_3)


@jit
Expand Down

0 comments on commit dc562ca

Please sign in to comment.