3D Ball-Ball Resolution#349
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #349 +/- ##
==========================================
+ Coverage 47.75% 47.91% +0.16%
==========================================
Files 159 159
Lines 10716 10734 +18
==========================================
+ Hits 5117 5143 +26
+ Misses 5599 5591 -8
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| @jit(nopython=True, cache=const.use_numba_cache) | ||
| def _resolve_ball_ball(rvw1, rvw2, R, u_b, e_b): | ||
| unit_x = np.array([1.0, 0.0, 0.0]) | ||
|
|
||
| # rotate the x-axis to be in line with the line of centers | ||
| delta_centers = rvw2[0] - rvw1[0] | ||
| # FIXME3D: this should use quaternion rotation in 3D | ||
| theta = ptmath.angle(delta_centers, unit_x) | ||
| rvw1[1] = ptmath.coordinate_rotation(rvw1[1], -theta) | ||
| rvw1[2] = ptmath.coordinate_rotation(rvw1[2], -theta) | ||
| rvw2[1] = ptmath.coordinate_rotation(rvw2[1], -theta) | ||
| rvw2[2] = ptmath.coordinate_rotation(rvw2[2], -theta) | ||
| frame_rotation = ptmath.quaternion_from_vector_to_vector(delta_centers, unit_x) | ||
| rvw1 = quaternion.rotate_vectors(frame_rotation, rvw1) | ||
| rvw2 = quaternion.rotate_vectors(frame_rotation, rvw2) | ||
| rvw1, rvw2 = _resolve_ball_ball_x_normal(rvw1, rvw2, R, u_b, e_b) | ||
| rvw1 = quaternion.rotate_vectors(frame_rotation.conjugate(), rvw1) | ||
| rvw2 = quaternion.rotate_vectors(frame_rotation.conjugate(), rvw2) | ||
| return rvw1, rvw2 |
There was a problem hiding this comment.
This has some potential to change 2D behavior, so I will:
- take a look at the ball-ball collision plots to verify the behavior is identical or near-identical
| rvw1 = quaternion.rotate_vectors(frame_rotation, rvw1) | ||
| rvw2 = quaternion.rotate_vectors(frame_rotation, rvw2) | ||
| rvw1, rvw2 = _resolve_ball_ball_x_normal(rvw1, rvw2, R, u_b, e_b) | ||
| rvw1 = quaternion.rotate_vectors(frame_rotation.conjugate(), rvw1) | ||
| rvw2 = quaternion.rotate_vectors(frame_rotation.conjugate(), rvw2) |
There was a problem hiding this comment.
It doesn't really make sense to rotate the r part of rvw. I should just leave r alone here and in the ball-cushion model that does something similar. It might introduce some error by doing a rotation then rotating it back.
There was a problem hiding this comment.
And same should be done to the existing ball cushion model
1e68809 to
f36d066
Compare
f36d066 to
1e6d397
Compare
Implement ball-ball FrictionalInelastic3D to resolve #312.
This is based on branch 3d-ball-ball-detection, so the diff will make more sense after #342 is merged.