|
|
Flipper, a LDraw
triangle pairs flipping tool
Flipper allows
to flip a pair of triangles (change abc + cbd into abd + dca).
This helps in some areas of "organic" meshes (eg.
hair pieces) to make them smoother (or on the contrary to create
a crease to add an edge line). Flipper
operates on colored pairs of triangles, thus allows the user
to choose the triangle pairs to swap. With some limitations,
it is also able to update condlines around modified areas.
It is a simple console application, source code
is provided below to anyone willing to integrate it in a more
palatable interface. You may also use Michael Heidemann LETGUI front-end (highly recommended!).
Download
Flipper
package, including program for Windows, documentation,
source files (Visual C++ 6.0), example files.
History
Usage
Here is a screen shot of a sample run:
How Flipper
works
- Input file is read and parsed, stored in an array.
- Array is scanned to find a triangle that is not main
color.
- Then we search another one that has the same color and
is adjacent. We then flip the triangles: triangles abc and
cbd are transformed into abd and dca.
- If -c option is not
specified, condlines bordering initial triangles are deleted,
and new ones are generated around each triangle after split.
If an edge line was present at the junction between flipped
triangles, it is deleted too but other edge lines are kept.
Only simple generation is done (condline created for any
angle > 0.1°, no condline created between the triangles
and touching primitives/subpart). For more fancy condlines
management, use Edger2!.
- If -u option is specified,
the whole file is returned to uncolored state (edge lines
and condlines to color 24, all other to main color 16).
- Output file is written.
Examples
|
Main usage of Flipper
is to flip triangle pairs that appear to be locally
concave when they should be convex (or vice-versa!).
This often happens in "organic shapes"
meshes, coming from LDD or 3D scan and reduction
of number of polygons. Not only shading look ugly,
but from some directions condlines are shown where
they look wrong. All you have to do is to color
the pair of triangles and run Flipper.
Command line: Flipper fl3.dat fl4.dat |
|
This may also be useful to remove "jaggies"
that appear in outlining. Of course, edge lines
in this area need to be rearranged (the line that
was between the two flipped triangles was automatically
removed by Flipper.
Command line: Flipper fl5.dat fl6.dat |
|
-c option prevents
conditional lines management: the condlines existing
in original file are left as-is. As you can see
on nearby thumnail, they won't match properly the
triangles. If you use this option you should at
some time regenerate condlines with Edger2.
This maybe necessary anyway since condlines regeneration
of Flipper is very
basic.
Command line: Flipper -c fl4.dat fl7.dat |
|
If you need to flip several adjacent triangle
pairs, use a checkerboard coloring pattern. Flipper needs to identify
pairs to be flipped!
Command line: Flipper fl8.dat fl9.dat |
|
-u option returns
the whole file to uncolored state (edge lines and
condlines to color 24, all other to main color 16).
Command line: Flipper -u fl8.dat fl10.dat |
|
Trying to flip 3 or more triangles at the same
time is generally not a good idea, as the result
depends on the order of triangles in the input file.
In this case it is better to do several successive
runs, each one flipping only pairs of triangles.
Command line: Flipper fl11.dat fl12.dat
Command line: Flipper fl13.dat fl14.dat |
|
-k <val>
option restricts operation to triangle pairs
colored in color <val>.
Command line: Flipper -k 14 fl8.dat fl15.dat |
|