Re: [Plib-users] CAM using plib was: Wanted--bitmap
Brought to you by:
sjbaker
From: Steve B. <sjb...@ai...> - 2001-04-22 22:44:32
|
Marlin Mixon wrote: > This is for a CAM application using foam and hotwire, so textures don't > actually come into play. Here's what I'm doing and I think I'm on the right > track: > > I'm taking an aircraft fuselage and presenting it in a true sideview with an > ortho projection. OK. > (ortho-projection = oxymoron?) No - there are other kinds of projection - Perspective for example. > (I'm not actually > interested in the textures, they are just a bonus in that they are pleasing > to the eye.) I see. > Then, by clicking my modified-viewer's right mouse button, it starts the > recording process: Using Steve Bakers snippet of code, I'll take a snapshot > image of the sideview, rotate the fuselage like it was on a barbecue spit 10 > degrees, take a snapshot, 10 more degrees, snapshot, etc. until I've got 18 > images for 180 degrees. Sounds painful. I would have taken the 3D model, saved in some simple ASCII format like 'TRI' (PPE can convert models to that) - and write a program to plot out the profiles in (say) Postscript with a grid behind them...but that's quite a bit of work. > Now I've got 18 profiles. I'll process them in such a way that I've got a > silhouette, that is I'm only interested in two colors: model vs background. > Finally, I'll need to figure out a way to compute the edge (A Sobel filter for example - GIMP has one of those) > i.e. find all > the white pixels sitting next to black pixels and figure out the set of line > segments that delineates the edge. This I will call the "linear profile." That's tremendously hard work...and a lot less accurate than going directly from the triangle data. I would: * Read the model into PPE. * Delete the wings and tail fins. (Select primitives and Edit/Cut) * Write the fuselage data out in ".TRI" format. * Read the data into a C++ program from a 'TRI' format file (it's *REALLY* easy to write a parser for that format). * Rotate the model whatever number of degrees is needed using routines from libplibsg * Compute the surface normal for each triangle (there is a PLIB/SG routine for that) - and discard those that are facing away from us. * Treat each triangle as three edges (each with two vertices). * Make a table of the UNIQUE vertices in the model...discard duplicate vertices. * Make a table of edges in the model - according to which vertices they share. * For each edge, check to see if there is a duplicate edge somewhere on another triangle. Delete all edges that have duplicates - along with those duplicates. * Since the only edges remaining came from triangles whose neighbours were back-face culled, we have a pretty good profile. > With the linear profiles, I can scale them up to real-world units and apply > them to my neighbor's computerized foam cutter: Situate the foam and cut > the first linear profile. Rotate 10 degrees and cut the second linear > profile, rotate, cut, etc. That should work. > After the 18 profiles have been cut, you will have a real-world replica of > the virtual fuselage. I know there will be a few limitations, like if you > left the tail feathers on, there would be some peaks and valleys that would > not be cut enough--excess material. Also any compound concavity won't be > rendered correctly such as scoop inlets. Yes...that's a problem...but it's inevitable with a hot-wire core cutter. So, if this works, you owe me a 2 foot tall foam model of Tux - OK? :-) -- Steve Baker HomeEmail: <sjb...@ai...> WorkEmail: <sj...@li...> HomePage : http://web2.airmail.net/sjbaker1 Projects : http://plib.sourceforge.net http://tuxaqfh.sourceforge.net http://tuxkart.sourceforge.net http://prettypoly.sourceforge.net http://freeglut.sourceforge.net |