Go Back   AC3D Forums > Technical > AC3D Developers
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 3rd August 2007, 07:35 AM   #1
Cynic
Member
Expert member
 
Join Date: Jul 2007
Posts: 71
Default Is there a max to the surface indices?

Andy, I'm putting the parabolic function on hold indefinitely while I work on something that has no workaround on the market (at least not one that is affordable).

The application I'm working on is a physical characteristic generator. Let me describe it.

Given a model, described by a 3D description file such as a *.ac, a mass and a scale (assuming you model at a scale that's less than full size), it will generate volume, density (assumption that density is uniform), moments of inertia described by a tensor, center of mass, center of percussion and on and on.

Because I need to read and maintain the model file, but not modify it, I need to know the dynamics of the file format to be read.

I've gone over the description you wrote up and I see the number of vertices that can make up a surface varies. Obviously it needs to be three at a minimum, but I've seen up to 6. Is there a maximum you've set so I can write a file reader?

Also, can I assume that because the points describe a discreet surface, that surface describes a plane? I could take any three vertices in order (caveat) and find the normal to the plane that surface lies on?

Last edited by Cynic; 6th September 2007 at 07:19 PM. Reason: wanted to correct the bad spelling in the subject.
Cynic is offline   Reply With Quote
Old 3rd August 2007, 10:12 AM   #2
Andy
Administrator
Professional user
 
Andy's Avatar
 
Join Date: Jun 2003
Posts: 4,563
Default Re: Is the a max to the surface indices?

Surfaces have no real maximum number of vertices - the number is an integer so the maximum is probably larger than you'd ever need.

You can't be sure that the vertices are planar if numvert > 3. You'd need to triangulate to ensure this - perhaps try using the .tri file format? (very easy to parse)

There's C source code for a .ac file parser and OpenGL viewer on the resources page.

Let us know how you get on.
Andy is offline   Reply With Quote
Old 3rd August 2007, 10:30 AM   #3
Cynic
Member
Expert member
 
Join Date: Jul 2007
Posts: 71
Default Re: Is the a max to the surface indices?

Thanks for the tip on the .tri file. All I really need is the vertices and surfaces (for which I can find the plane) and that's it. The .tri file should prove useful.

But I'll still look at all options.

I like the idea of a list of vertices (w/o duplication) with each surfaced described by a idx into the v list that the ac file produces.
Cynic is offline   Reply With Quote
Old 22nd September 2007, 06:38 PM   #4
Cynic
Member
Expert member
 
Join Date: Jul 2007
Posts: 71
Default Re: Is the a max to the surface indices?

Well, it took a while, mainly because it touched on areas of geometry I haven't discovered until now (barycentric space), but I have something that seems to be working.

I've tested it successfully with a cube, so far (not sure how I'll verify the results with anything more complex), but it works.

It's a span algorithm, perhaps not the most intelligent, but it works quite nicely and has a margin of error of up to 1.08% by default tested with an axially aligned 1x1x1 cube.

It should be noted that when the cube is rotated, the margin of error drops an order of magnitude to 0.28%. I'm not entirely sure why (speculating overscan), but happy I got it working.

I'll need to test against several other easily calculable geometric figures and once I'm satisfied, I'll call it good! This may very well be the second program in my life I actually finished.

I'd celebrate with Heinekens, but that's what slowed me down.

Last edited by Cynic; 22nd September 2007 at 06:40 PM.
Cynic is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT -4. The time now is 06:09 PM.


AC3D Forum
(C) Inivis Limited 2020