-
-
Notifications
You must be signed in to change notification settings - Fork 360
Adding Verlet Integration in Swift #263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding Verlet Integration in Swift #263
Conversation
The code looks good, but take a look at #257. We decided to move the |
Sounds good just updated my code accordingly 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It took me a few days to get back to this, but let's get it done now.
|
||
func stormerVerlet(pos: Double, acc: Double, dt: Double) -> (time: Double, vel: Double) { | ||
var temp_pos, time, vel: Double | ||
var paramPos = pos |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a quick question: Why is this variable needed? Are parameters immutable by default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ya parameters in Swift are immutable by default. Your comment made me realize though that there is a much cleaner way to do the same thing. So I replaced var paramPos = pos
with var pos = pos
.
var prev_pos = pos | ||
time = 0.0 | ||
|
||
while (paramPos > 0){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ew! No space between )
and {
...
vel = 0 | ||
time = 0 | ||
|
||
while (paramPos > 0){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing as further up. No space.
Just made the necessary revisions |
@Butt4cak3, are you good with the changes? |
I'm sorry that it took me so long to get back to this. I was taking a break and thought I was done with everything I was assigned to. I'll merge this as soon as I get home today. |
Alright. I had to get into this again because it's been a while. Everything checks out, so this can go straight to master. Sorry again, @CDsigma. |
Added Verlet Integration in Swift