I did not create the majority of the code in this plugin. The core of the MetaShape plugin is the example code in the Implicit Surface plugin. The main algorithm for creating the surface of the MetaShape is directly from the original. I provided a surface function, a few controls, and a method for defining shapes and properties using the Skeleton naming conventions. The algorithm seems to have some problems with disjoint surfaces, and I will look into improving the code as I get time.
There are plenty of Blob/Metaball implementations documented in great detail on the Web, and I chose the POVRAY definition for it’s general acceptance, and because it would be fairly easy to write a translator for POVRAY files.
The function used is:
Density =
Strength * ( 1 – ( Distance / Radius )˛ )˛
POVRAY defines two types of MetaShapes; Blobs and Cylindrical Blobs
Each edge with both ends selected is considered a potential MetaShape by the plugin. In addition both vertices must be attached to a skeleton node (or parent node) named for a MetaShape. I have initially implemented two types of shapes; MetaBalls or Blobs, and MetaSplines. MetaSplines are exactly like POVRAY Cylindrical Blobs except that each end can have it’s own Strength and Radius properties.
The properties of the MetaShape are stored, like the type names, in the skeleton naming hierarchy. Two properties are defined; Strength and Radius. The Radius property is only used for MetaSplines, because the length of the edge defining the MetaBall represents the diameter. Properties are determined by looking at the skeleton node names from the vertice’s node up to the root node of the skeleton.
To define a property, name the node STRENGTH <n> or RADIUS <n>, where <n> is a valid floating point number. Comparisons are always case insensitive. (This includes type names)
If no matching property name is found, the value defaults to 1.0.
The edge represents a MetaBall with its position centered on the edge midpoint, and the diameter of the MetaBall being determined by the length of the edge. Strength is determined by averaging the strengths of the two vertices of the edge. A chain of MetaBalls can be created by drawing a zig-zag line such that the midpoints of the edges line in a line. Remember that the strength can also be negative ( or zero when averaged ).
In this case the edge represents the axis and length of the “cylindrical” shape. The actual shape when the ends of the spline are different sizes is more like a rounded cone. ( I like to call them “Weebles” ).
The Radius and Strength properties are both defined using the property naming convention, and vary linearly along the length of the MetaSpline. An spline edge that is unconnected to other spline edges, and has the same radius and strength at both ends is equivalent to the POVRAY Cylindrical Blob.
As I was looking for ways to store information using only edge information, I realized that you can store great deal of information with just two points in space. ( Position, Direction, and Distance )
I realized that other shapes could be defined using just edges, and here are some of my ideas for additional shapes.
MetaToroid: The edge midpoint is the center, the edge is the axis of rotation, and the length is the outer radius. Radius (Inner) is defined like splines.
MetaPlane/Disk: The edge midpoint is on the plane, and the edge points away from the plane, and the length of the edge is the thickness of the plane. Radius could be defined to for a Disk shape.
Please include the example models included with the plugin if you re-distribute the code. The examples included should demonstrate the naming conventions and tips and shortcuts for modeling without the full advantage of real-time feedback.