Skip to content

Commit

Permalink
Fix to danger space.
Browse files Browse the repository at this point in the history
  • Loading branch information
dbookstaber committed Feb 25, 2024
1 parent 974e328 commit b0cb39b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions py_ballisticcalc/trajectory_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ def danger_space(self,
def find_begin_danger(row_num: int) -> TrajectoryData:
"""
Beginning of danger space is last .distance' < .distance where
|target_center - .drop'| >= target_height/2
(.drop' - target_center) >= target_height/2
:param row_num: Index of the trajectory point for which we are calculating danger space
:return: Distance marking beginning of danger space
"""
Expand All @@ -267,14 +267,14 @@ def find_begin_danger(row_num: int) -> TrajectoryData:
target_center = center_row.drop.raw_value + tan_look_angle * (
prime_row.distance.raw_value - center_row.distance.raw_value
)
if abs(target_center - prime_row.drop.raw_value) >= target_height_half:
if (prime_row.drop.raw_value - target_center) >= target_height_half:
return self.trajectory[i]
return self.trajectory[0]

def find_end_danger(row_num: int) -> TrajectoryData:
"""
End of danger space is first .distance' > .distance where
|target_center - .drop'| >= target_height/2
End of danger space is first .distance' > .distance where
(target_center - .drop') >= target_height/2
:param row_num: Index of the trajectory point for which we are calculating danger space
:return: Distance marking end of danger space
"""
Expand All @@ -283,7 +283,7 @@ def find_end_danger(row_num: int) -> TrajectoryData:
prime_row = self.trajectory[i]
target_center = center_row.drop.raw_value + tan_look_angle * (
prime_row.distance.raw_value - center_row.distance.raw_value)
if abs(target_center - prime_row.drop.raw_value) >= target_height_half:
if target_center - prime_row.drop.raw_value >= target_height_half:
return prime_row
return self.trajectory[-1]

Expand Down

0 comments on commit b0cb39b

Please sign in to comment.