Finally done for the most part

My first project, at least the first part of it, since resurrecting my programming skills is complete, mostly. The core of it works as expected, but it could use some extending. I'm not quite sure how long it took, a month of casual programming? Maybe?

What it is:

Baseline, it creates a list of spans used to calculate the volume, and ultimately the density, center of mass, moments of inertia and center of percussion of a 3D geometric object. As of now, I write the spans to a file. Testing on a 1 x 0.125 x 0.125 tube/pipe using a 0.001 resolution took about 1-1.5 mins and produced a 11.7M file. That is actually expected. I could shrink it by making it a binary file instead, but I'm going to leave it as a text file for now.

I haven't actually calculated the volume off the data yet, but will in the next week and I can actually compare it against a more precise result since the tube is not all that complex, I can simply calculate the area of the end caps and multiply by the length to get an idea of how accurate is the resulting spanner.

Why did I do this?

I'm developing a 3D space shooter, but I'm not all that happy with physics engines on the market. Fallout 3 used Havok(I think it costs > $10,000) and I saw critters flying 2-3 football fields away after getting shot and even Newton which is free shamefully failed the integrator test so badly, it had to be put on its own scale.

Plus, you can't really plug in more detailed info on an object, such as a user defined CoM and such.

Lastly, I needed a project as a goal for resurrecting my programming and learn C++ a little more.

What's next:

The second part is taking all the spans and getting the physical details off them.

Anyway, I'm kind of happy. I have a working copy and I can continue to improve the util w/o losing the use of a working copy.
Last edited on
Sweet, did a preliminary test and the accumulated volume from my spanner came to 0.00513666 and the volume calculated off the modeler was 0.005127. A 0.0018% difference. I'm happy so far.

I'll have to try with some other objects.
I don't get at all what you're doing.
When you say, span, which one do you mean http://en.wikipedia.org/wiki/Span
And how something that takes 1.5 min could be useful in a game physics engine?
It's more for the physics side for calculating the volume of more complex 3D objects. It's not for real-time at all. It's for setting up physical properties of objects to be written to a file.

http://en.wikipedia.org/wiki/Linear_span

I think this is it.

Say I have a Hammerhead class destroyer and its mass is 3200 metric tons. When figuring the moments of inertia and center of mass, I could simply take the bounding box, but if the object in question has a complex shape, those properties are likely to be off significantly.

My spanner will take a complex object and calculate the volume, which in turn is used to calculate the density, which in turn is used to calculate moments of inertia and center of mass, center of percussion, etc.

Moments of inertia and center of mass is additive. If I take these numbers of individual ship parts, then construct a ship from these individual parts, I can simply add the numbers to find summation.
Last edited on
Will this finally disprove the feasibility of the Millenium Falcon?
Lol, the Millennium Falcon was rather symmetrical. Other than it's wild movement without some means of vectoring thrust or use of maneuvering jets, I think it's possible, if it used some form of inertial guidance (gyroscopic or such).

Now, the Enterprise, that's a different story.

PS: scanned a more complex object:

http://i1186.photobucket.com/albums/z373/rjsprawls/Aurora%20SC/Image1.jpg

With a 0.002% deviation from calculated results. The object underscored a failing in my code, but it was an ultra simple fix.

Last edited on
Topic archived. No new replies allowed.