WSM is a polyhedral geometric modeling kernel. It supports the following topology, similar to ASM (Autodesk Shape Manager):
In WSM, Edge
s are linear and Face
s are planar. Smooth curves and surfaces are approximated.
Object
is the base class for all objects that support operations such as undo/redo, save/restore, etc.
Topology and other derived object types are not exposed directly in the WSM public interface.
Rather, object instances are manipulated by referencing their Object IDs.
WSM supports the following topology object types:
Vertex
: A point in space. Represented by a 3D point and vector of owning Edge
s.Edge
: A bounded line in space. Represented by one or two Vertices.Coedge
: Connects Edge
s together into a Loop
. Represented by an owning Loop
, and pointers to an Edge
, as well as previous, next, and partner Coedge
s.Loop
: The boundary of a Face
. Represented by an owning Face
and a pointer to the first Coedge
.Face
: A bounded piece of a plane. Represented by one or more Loop
s.Shell
: A set of connected Face
s. Represented by one or more Face
s.Lump
: A connected volume in space; could have zero volume, i.e. a sheet. Represented by one outer Shell
and zero or more inner Shell
s.Body
: A volume in space; could have zero volume, i.e. a sheet. Represented by spatially distinct Lump
s.WSM also supports the supports the following object types:
WSM supports:
The WSM API exposes the following supporting classes, data structures, constants and macros for:
WSM history management is implemented using 3 classes: History
, which contains two vectors, namely ObjectHistory
, and Delta
.
History
is used to store undo and redo information, and provide history related facilities for the rest of WSM code. Each Object has an ID that is unique in its History.
The Object ID is the index into the ObjectHistory
vector.
The Delta
vector contains a vector of IDs.
There may be several unrelated history streams (History instances), each maintaining model data unrelated to data in other history streams, i.e. all Object IDs, Delta timestamps, active Delta index, etc. are unique and make sense only within a given history stream. The data structure within a single history stream is illustrated by the following simplified diagram (some class variables are omitted for clarity):
The actual objects, one instance per the Object version, are owned by an ObjectHistory instance corresponding to this Object: the size_t value returned by Object::GetID() can be used to access this Object's history via History::m_aObjectHistories in the given history stream. Note that to uniquely identify an Object, one needs two IDs: the History ID and Object ID within this history. Each Object's ObjectHistory contains all the versions of this Object, with the "live" version corresponding to the index (m_nCurrentIndexPlus1 - 1). The 0 value of m_nCurrentIndexPlus1 means that this ObjectHistory refers to the state before the Object has been created. If there are Redo states (i.e. there were one or more Undo executed on this Object and the Redo Delta-s were not yet discarded), then m_nCurrentIndexPlus1 is less than the size of m_aDeltaObjectVec and Redo operations are possible. In particular, the 0 index in an Object's ObjectHistory::m_aDeltaObjectVec is the Object at its time of creation, the larger indices correspond to changes to the Object, and the final index can be NULL meaning the Object has been deleted at that index's Delta.
Another important point, which permits safe use of Object pointers within WSM, is that the pointer to the current state of an Object never changes after this object is first created. When the active version of an Object is rolled back (by Undo) or forward (Redo), the contents of the previous or next version of this object is swapped with the Object instance pointed by the never changing Object*, so, all other objects not affected by these changes still hold on to the same pointer. As a result, the validity of the model is maintained without the overhead of converting between persistent IDs and changing pointers, and the only overhead involved is Object data swapping during Undo/Redo.
WSM supports serialization to the internal .wsm file format. It also supports the following formats:
![History_diagram.png]: (resources/History_diagram.png) "Data structure within a single history stream"