Here is a list of the operations to be added within a program for iterative refinement or coarsening of a k-dimensional tesselation embedded in d dimensions, in order to record its history.
It is recommended to free all data structures used by the refinement or simplification process before building the MT. In fact, there may not be enough memory to hold both such structures and the MT.
Here is a list of operations to be performed in order to convert a recorded history into an MT.
We assume that, given a vertex V of the current tesselation within the user program, the MT_INDEX field associated with V is named V.index; and, given a tile T, the MT_INDEX field associated with T is named T.index.
#include "mt_build.h"
....
MT_BuildingInterface bi; /* the building interface */
MT_MultiTesselation mt; /* the MT to be built */
/* create mt as a 2-dimensional MT (tiles=triangles) in 3D */
mt = new MT_MultiTesselationClass(3,2);
/* create the building interface */
bi = new MT_BuildingInterfaceClass();
/* start a history for a 2-dimensional MT in 3D, we assume that
our program is based on iterative refinement */
bi->MT_StartHistory(3,2, MT_REFINING);
/* initialize all MT_INDEX fields of vertices and tiles */
for (... every vertex V of the initial tesselation ...)
{ V.index = MT_NULL_INDEX; }
for (... every tile T of the initial tesselation ...)
{ T.index = MT_NULL_INDEX; }
/* record the update that creates the initial tesselation */
for (... every tile T of the initial tesselation ...)
{
V1, V2, V3 = ... the three vertices of T ...
V1.index = bi->MT_UseVertex(V1.index, V1.coordinates);
V2.index = bi->MT_UseVertex(V2.index, V1.coordinates);
V3.index = bi->MT_UseVertex(V3.index, V1.coordinates);
T.index = bi->MT_MakeTile();
}
bi->MT_EndUpdate();
/* main loop */
for (... every update performed on the current tesselation ...)
{
/* record the current update */
for (... every tile T deleted in this update ...)
{ bi->MT_KillTile(T.index); }
for (... every new vertex V created in this update ...)
{ V.index = MT_NULL_INDEX; }
for (... every new tile T created in this update ...)
{
V1, V2, V3 = ... the three vertices of T ...
V1.index = bi->MT_UseVertex(V1.index, V1.coordinates);
V2.index = bi->MT_UseVertex(V2.index, V1.coordinates);
V3.index = bi->MT_UseVertex(V3.index, V1.coordinates);
T.index = bi->MT_MakeTile();
}
bi->MT_EndUpdate();
}
/* record an update deleting the final tesselation */
for (... every tile T of the current tesselation ...)
{ bi->MT_KillTile(T.index); }
bi->MT_EndUpdate();
/* end history recording */
bi->MT_EndHistory();
/* ...free all memory that is no longer needed... */
/* set the description string to be associated with the resulting MT */
bi->MT_SetDescription("A 2-dimensional MT in 3D");
/* connect mt to the building interface */
bi->MT_SetTarget(mt);
/* build mt from the history just recorded */
bi->MT_Convert();
/* now, mt contains the MT resulting from construction */