We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents d831f3d + 6201f98 commit a9564b8Copy full SHA for a9564b8
test/downstream/community_callback_tests.jl
@@ -155,12 +155,8 @@ function affect!(integrator, idx)
155
x₂ = u.nodes[l][1:2]
156
v₂ = u.nodes[l][3:4]
157
# https://stackoverflow.com/a/35212639
158
- v₁ = (v₁ -
159
- 2 / (1 + 1) *
160
- (dot(v₁ - v₂, x₁ - x₂) / sum(abs2, x₁ - x₂) * (x₁ - x₂)))
161
- v₂ = -(v₂ -
162
163
- (dot(v₂ - v₁, x₂ - x₁) / sum(abs2, x₂ - x₁) * (x₂ - x₁)))
+ v₁ = (v₁ - 2 / (1 + 1) * (dot(v₁ - v₂, x₁ - x₂) / sum(abs2, x₁ - x₂) * (x₁ - x₂)))
+ v₂ = -(v₂ - 2 / (1 + 1) * (dot(v₂ - v₁, x₂ - x₁) / sum(abs2, x₂ - x₁) * (x₂ - x₁)))
164
165
println("Collision handled.")
166
0 commit comments