Skip to content

Commit

Permalink
Remove assertion of velocity value and clip it instead
Browse files Browse the repository at this point in the history
  • Loading branch information
Kazuho Okui committed Dec 18, 2015
1 parent c26a4ea commit d560b8d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion RK4Spring.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ public func RK4SpringAnimation(tension tension:Double, friction:Double, initialV

assert(tension >= 5 && tension <= 1000, "Tension should be 5 ~ 1000")
assert(friction >= 5 && friction <= 100, "Friction should be 5 ~ 100")
assert(initialVelocity >= -100 && initialVelocity <= 100, "Velocity should be -100 ~ 100")

if initialVelocity < -100 {
initialVelocity = -100
}
else if initialVelocity > 100 {
initialVelocity = 100
}

var result:[Double] = []
var value:Double = 0
Expand Down

0 comments on commit d560b8d

Please sign in to comment.