Skip to content

Commit 6201f98

Browse files
committed
Fix arithmetic expression line splits in collision physics
Fixed 2 instances of unnecessarily split arithmetic expressions in collision handling code. Expressions are now more readable on single lines while staying under 120 characters. Following Catalyst.jl PR #1306 guidelines. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 0944c25 commit 6201f98

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

test/downstream/community_callback_tests.jl

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,8 @@ function affect!(integrator, idx)
155155
x₂ = u.nodes[l][1:2]
156156
v₂ = u.nodes[l][3:4]
157157
# 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-
2 / (1 + 1) *
163-
(dot(v₂ - v₁, x₂ - x₁) / sum(abs2, x₂ - x₁) * (x₂ - x₁)))
158+
v₁ = (v₁ - 2 / (1 + 1) * (dot(v₁ - v₂, x₁ - x₂) / sum(abs2, x₁ - x₂) * (x₁ - x₂)))
159+
v₂ = -(v₂ - 2 / (1 + 1) * (dot(v₂ - v₁, x₂ - x₁) / sum(abs2, x₂ - x₁) * (x₂ - x₁)))
164160

165161
println("Collision handled.")
166162

0 commit comments

Comments
 (0)