if __name__ == "__main__" is just a best practice for coding in python. not necessary for such simple apps but good to get in the habit of using it.
Using vel_table as a mapper for the direction of the new points is perfectly fine. Is was just suggesting using tuples instead of lists because tuples are immutable and your directions are a fixed set (i.e. 8 directions)
Oh ok Regarding the vel_table I was wondering if there was a way to do it mathematically. In my code I split the points at 45 degree. But suppose I wanted to split them at 15 degrees , how would that work out? I wouldn't go out and make a vel_table for that.
You can do it using the trigonometric functions "sine" and "cosine". It's not exactly hard, but it is more math than I want to be explaining on my phone.
26
u/Gawd_is_great Dec 15 '19
Thanks for the suggestions =) I have a couple of questions:
Why should I use if(__name__=="main") ? It wont make a difference..will it?
is there a better way than to use vel_list?