Fix #112 by avoiding divide-zero-by-zero
This commit is contained in:
parent
d75f56cdc1
commit
90ef9a08f3
|
@ -139,9 +139,9 @@ def _add_deflection(position, observer, deflector, rmass):
|
|||
qmag = length_of(pq)
|
||||
emag = length_of(pe)
|
||||
|
||||
phat = position / pmag
|
||||
qhat = pq / qmag
|
||||
ehat = pe / emag
|
||||
phat = position / where(pmag, pmag, 1.0) # where() avoids divide-by-zero
|
||||
qhat = pq / where(qmag, qmag, 1.0)
|
||||
ehat = pe / where(emag, emag, 1.0)
|
||||
|
||||
# Compute dot products of vectors.
|
||||
|
||||
|
|
Loading…
Reference in New Issue