Archived

This topic is now archived and is closed to further replies.

skap20

Advice for my Physics Engine

Recommended Posts

I am starting a new physics engine project and would like some advice about how I should design it. What type of naming convention should I use for the equations? I thought of two possibilities: try to come up with a descriptive name for each of them (such as "light_refraction" for an equation that solves for the angle of refraction). The problem is that there are so many equations that it may become too difficult to remember the exact names of the functions. The other option is to enumerate each function and name them light_001, or thermo_145. Then, I would have a table in the help file that has each function''s purpose, and sort it according to categories such as light and thermo. Does anyone think either of these two methods would work? If not, please suggest any other naming scheme. So far, I''ve been leaning toward the enumerated option. Also, feel free to suggest any specific areas of physics that should be included in a physics engine. Finally, if anyone knows of some good physics engines let me know so I can see what areas are covered by other programs. -------------------- Nicholas Skapura skapura.2@wright.edu http://skap.8k.com AIM: skap35

Share this post


Link to post
Share on other sites
Don''t ever ever ever ever do the second. It''s HORRIBLE coding style. Really, really horrible. Someone reading your code doesn''t want to have to jump to the "function table of contents" every three seconds.


How appropriate. You fight like a cow.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:
Original post by skap20
The other option is to enumerate each function and name them light_001, or thermo_145. Then, I would have a table in the help file that has each function''s purpose, and sort it according to categories such as light and thermo.

Is there a reason why you can''t have descriptive names AND a table describing each function''s purpose?

Share this post


Link to post
Share on other sites
Yeah you are right, Sneftel, it probably would make it pretty unreadable. I will probably use a naming convention like type_name(). So something like "kin_projectile()" for a projectile equation, which would be in the kinetics module.

--------------------
Nicholas Skapura
skapura.2@wright.edu
http://skap.8k.com
AIM: skap35

Share this post


Link to post
Share on other sites
You could just use namespaces?

like

namespace Kinetics
{
void MyFunc()
{

}
}


then:

Kinetics::MyFunc();

~Graham

[edited by - gwihlidal on June 7, 2003 4:48:45 PM]

Share this post


Link to post
Share on other sites