nature-of-code / noc-examples-processing

Repository for example code from The Nature of Code book
MIT License
2.56k stars 950 forks source link

A simple question about the path following code #102

Open 4skinSkywalker opened 6 years ago

4skinSkywalker commented 6 years ago

I have a question about NOC_6_05_PathFollowingSimple

In the Vehicle class you calculate the target position outside the if (distance > p.radius), but actually you apply seek(target) only if in that condition is true, could you save some calculation by moving the logic for finding the target within the if (distance > p.radius) block?

Why did you choose to put that logic outside the conditional? Just for debugging reasons or there's something else useful you can do with that?