Application shapeSurvey
shapeSurvey is an OpenGL browser for a shape library. It answers the two
questions that come up whenever a shape file has been written by hand or
produced by a converter: does this shape look like what I meant? and are its
mass properties right?
shapeSurvey shapes.txt
It is also the tool that pre-computes a library. A shape whose
preCompDone is n has its volume, inertia and bounding box recomputed
every time a simulation starts; running the computation once here and saving the
result removes that cost, and lets you check the values before they are used.
Browsing the library
Key |
Action |
|---|---|
|
Next / previous shape. A shape whose |
|
Show the help. |
|
Print the extents of the bounding box in the terminal. |
|
Decrease / increase the transparency. |
|
Background colours on/off. |
|
Roll the camera about the viewing axis. |
|
Quit. |
The mouse rotates, pans and zooms as in see.
Computing the mass properties
Key |
Action |
|---|---|
|
Compute the mass properties of the current shape, and set its
|
|
The same for every shape of the library that is still marked |
|
Reset |
|
Multiply / divide by ten the number of Monte-Carlo samples
( |
|
Clean every shape, removing the duplicated entities. |
The volume and the inertia of a sphero-polyhedron have no closed form in the
general case, so they are estimated by Monte-Carlo sampling. The accuracy
therefore depends on MCnstep, and the estimated relative error on the volume
is printed with the result.
Tip
Increase MCnstep with N until the printed error is small enough for
your purpose, then press C and s (or use -P). For a shape used as a driven wall
the default is plenty; for a grain whose mass drives the dynamics, it is
worth a few more samples.
Note
A shape marked preCompDone y is trusted: Rockable uses the volume and
the inertia written in the file without checking them. This is efficient, and
it is also how a wrong value gets used silently, so it is worth looking at
the numbers once.
Fitting the bounding box
Key |
Action |
|---|---|
|
Cycle through the fitting strategies: covariance, minimum volume,
axis-aligned, imposed axis. The chosen one is stored as
|
|
Build the OBB-tree of the current shape. |
|
Show one level less / one level more of the tree. |
The oriented bounding box is what the neighbour detection uses first, so a poorly fitted box costs time on every step. The four strategies differ in what they optimise: the covariance fit is fast and usually good, the minimum-volume fit is tighter on elongated shapes, and the axis-aligned one is only relevant for shapes already aligned with the axes.
Warning
The OBB-tree, and the OBBtreeLevel keyword of the shape files, are
deprecated. The tree can still be built and displayed here, but the
contact detection is driven by AddOrRemoveInteractions, whose
OBBtree option builds what it needs on its own.
Saving
Key |
Action |
|---|---|
|
Save the library in |
|
Export a sample: one particle per shape, laid out so that the library can
be opened directly in |
Note
An existing mod_<file> is overwritten without asking. Rename it before
using it: mv mod_shapes.shp shapes.shp.
Typical workflow after a conversion
stl2shape -r 0.01 -c mesh.stl # -> mesh.shp, preCompDone n
shapeSurvey mesh.shp # look at it
shapeSurvey mesh.shp -P mesh.shp # pre-compute, in place, without window
The library is then ready for a simulation, and no shape will be recomputed at
start-up. In the window, the keys C then s do the same as -P, but
write mod_mesh.shp.
Command line
shapeSurvey <shapeFile> [options] opens the window, except with one of the
two options below, which do their work and exit.
Option |
Description |
|---|---|
|
Compute the mass properties of every shape marked |
|
Render one shape to an image ( |