Skip to content

Commit

Permalink
add interpolation step before converting from polar to cartersian
Browse files Browse the repository at this point in the history
  • Loading branch information
HugoMVale committed Apr 21, 2024
1 parent 8c82d7a commit 8dc11f0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/polykin/math/jcr.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,9 @@ def event(t: float, y: np.ndarray) -> float:
print("Warning: offset between start and end positions of JCR > 10*rtol.")

# Convert to cartesian coordinates
x = center[0] + r*cos(theta)
y = center[1] + r*sin(theta)
theta_interp = np.linspace(0, 2*np.pi, 1000)
r_interp = np.interp(theta_interp, theta, r)
x = center[0] + r_interp*cos(theta_interp)
y = center[1] + r_interp*sin(theta_interp)

return (x, y)

0 comments on commit 8dc11f0

Please sign in to comment.