Stickkit
Stickkit is a command-line tool for manipulating segmented vector geometry in 2D or 3D space. It is a single ANSI C file and requires no special libraries to build on most machines. It fills a gap that I found in command-line geometry processing software: a tool designed specifically for segmented geometries (graphs and networks).
Note that similar software is available for three-dimesional triangle meshes: first my own Rocktools, and also the very powerful tool Meshlab---a GUI triangle mesh manipulation tool that can read and write a number of formats, plus perform a large variety of smoothing and simplification operations.
Files
The current version of Stickkit is 0.5. You can download it here: stickkit.c. On a Linux or OSX system, build it with:
cc -O2 -std=c99 -o stickkit stickkit.c -lm
or, to cross-compile for Windows on Linux, use:
/usr/local/bin/i386-mingw32-gcc -O2 -o stickkit.exe stickkit.c -lm
Features
Stickkit can do a few interesting things:
- Reads Wavefront-.obj-like files (which I call ".seg" to differentiate from the tri-mesh standard) with tangents and radii and reads Radiance lists of cylinders, cones, and spheres.
- All node locations, tangent vectors, and radii are dynamically stored in a binary tree and duplicate entries are quickly found and removed, so meshes using 10-20 million segments load, process, and write relatively fast.
- Basic operations include multi-axis scaling and translation.
- Coarsen operation removes nodes such that all segments have a minimum length. New nodes are placed according to spline interpolation of the original paths.
- Likewise, the refine operation adds new nodes along spline-interpolated paths such that no segment exceeds a maximum length.
- Roughen operation displaces each node according to a Gaussian (diffusion-like) distribution.
- Split operation splits input geometry smoothly along its longest axis and writes two separate files.
- Most operations can be stacked, for example: -coarsen 0.01 -roughen 0.3 -refine .005 -roughen 0.3 -refine .002 -roughen 0.3 and will be performed in order.
- VTK files can be opened in ParaView, an open source scientific visualization package from Kitware/ASC/Sandia/LANL/ARL. Most of the images below were made using ParaView.
Images
Comparison of roughened and unroughened geometries, colored by radius;
stickkit trace2.seg -coarsen 0.01 -roughen 1.0 -vtk > rough1p0.vtk
Triangle mesh edges created with vort3d, the vortex sheet motion software from my dissertation research;
run02_freg056.seg
Future plans
Future versions of Stickkit may include the following:
- Reading multiple input files, and reading from stdin
- More tools and manipulations
- More input/output formats (are there any more?)
Please e-mail me if you'd like to see some particular feature in Stickkit, or if you use it to make something creative.