[Image of Linux]
The Personal Web Pages of Chris X. Edwards

vmaster - 3d Vector View Master

-------------------------- Some example output:

vmaster is a sophisticated 3d to 2d vector filter written entirely in C++.

CONCEPT

The idea for vmaster came from the frustration of not being able to plot simple datasets of 3d vectors. I was doing some experiments with vector geometry which produced quite a lot of data and I couldn't find a simple way to have a look at it graphically. I found the GNU plotutils package which seemed very promising, but its included program, graph, was rather heavily oriented to X vs. Y style "graphs". My requirements were much less structured and certainly not oriented towards traditional mathbook graphs. To cure this problem for 2d data sets, I wrote a program called gradu (graphics dump) which does a fine job of plotting such data. My next goal was to solve the same problem for 3d data sets. My idea was to break up the functionality into the smallest possible packages. This meant that I would write a program that would take the 3d data and turn it into 2d data. This way it could then be piped to gradu. This program doesn't merely strip the 3rd coordinate. You could use sed if you wanted that. It is a full featured view preparer which includes hidden line removal, camera positioning, and (coming soon) perspective parameter specification. It creates all 2d vector information needed to plot a scene based on a supplied model and given viewing conditions.

STRATEGY

The first thing I had to decide is how would the model be defined. The primary purpose of vmaster is to create views. This is a different task from being a CAD system or other engineering software with a higher purpose. I only really wanted to concentrate on 3d model elements that had a bearing on a view. For example, a cylinder may be modelled as a cylinder in some kind of engineering software, but when it's time for viewing the cylinder, the software must decompose the cylinder into simpler elements before passing them to vmaster.

The elements I chose to use were basically the element that is visible, lines, and the element which creates opaque barriers to visibility, triangular faces. As far as I can tell, all vector model scenes can be defined with these two things. The vmaster input allows for lines, trifaces, and the points that define them. Note that the points have no validity as stand alone entities. They can't be output as dots.

The data input is very flexible. It basically consists of one or more text streams that have one element per line. Each line consists of a delimited group of numbers. The number of numbers controls which element is being specified. For example, if there are two numbers, then the it is interpreted as two endpoints of a line.

One of the keys to the flexibility is the parsing routine. The general strategy is that characters that aren't relevant get replaced with spaces and spaces are the delimiters. This means that whatever crazy syntax your input may have, there probably isn't a lot that needs to be done with it to make it work out. Certainly a quick visit to the sed command should be able to cure any problems.

Data can be specified as files on the command line or piped in using the finest Unix traditions. Output is fairly generic and can be used as you see fit, but it is designed to work well with my program gradu (graphics dump).

One nice feature is that redundant entities are handled well. If you send in a line that goes from point A to point B and another from B to C, B is only stored once. This insures that rounding nonsense doesn't walk the two points away from each other. It also allows (in theory) for a quick transformation of the entire model which is a primary element of what this program is all about.

vmaster features two very nice hidden line removal strategies. The first is where a triangular face (opaque) obscures a line or part of a line. This is a standard HLR system. I even added a nice system to properly handle lines that pierce the middle of triangular faces. The second HLR idea is what I call the shallow angle cull (there must be a real technical name for it). This is eligible when exactly two triangle faces share 2 points in common and the same 2 points also define a line. If this is the case and the angle between the two faces is below a supplied threshold, the line between the common points is not considered. The exception to this rule (and therefore the only reason to supply such data) is if the line in question makes a defining edge. This means that cylinders which are aproximated as extruded polygons come out looking like cylinders, not Greek columns.

CAVEATS

Everything is ready, but some things aren't implemented yet. The perspective stuff is ready to go, but just not turned on in the program. The twist routine is not there yet, but it's easy.

I think that there are some times where the HLR doesn't work, but I've been getting really good results with some pretty complex things, so I'm feeling pretty good about it. Still it needs more testing and fixing. I think it's especially vulnerable on the boring views anyway. This means that orthogonal head on shots (gulp! the default!) are possibly going to be ugly.

DOWNLOAD

The program is available here: vmaster.tgz

It is only 31kB. It doesn't include any samples right now, but I'm working on that.

Also, you can check out the capabilities of vmaster by looking at the html man page for vmaster.

LEGAL NONSENSE

This program is released under the GNU Public License (GPL). It is so flawed that it should be considered dangerous to whatever you're doing, your data, your physical computer, your health, and sanity. Do not use it under any circumstances. I am not responsible for any silly thing either you or I do with regard to this program.

--------------------------
Return to Main Page *** Return to Program Page
This page was created with only free, open-source, publicly licensed software.
This page was designed to be viewed with any browser on any system.
Chris X. Edwards ~ May 2002