Morph Sample
Source code for Profile sample is available in Samples\VC  folder of the installation directory. It is recommended to 
copy whole VC directory to location outside of the installation folder
before loading or compilation. Morph sample demonstrates direct manipulation of
an object surface using set of meshing interfaces. It also implements runtime
creation of a meshed object without reading any model file. 
See also IMesh,  C# .NET Samples,  All samples 
The application  
By default the application does not load any model files. It creates a simple
meshed object in memory. Controls on the right hand side display all information
about the current simplex, the current vertex. Correspondent pairs of buttons
allow browsing through the set of all elements.  The current Simplex is
displayed in 3D in a violet wire frame. The current vertex is displayed as a
thick red dot.  
Update buttons allow modification of vertices  and normals. 
"Browse vertices" group allows switching between browsing vertices
independently or for the currently selected simplex. 
When the current vertex is a singular one ( edge or corner vertex ) there are
more than one normal at the point. UpDown control in the Current normal group
allows selection of the current normal. The current normal is displayed in 3D
with a green color. 
TThe application allows selection of an object in the model as the current
one. The current object is highlighted in 3D with a reddish color. Switch to
Surface mode using Render group to see it. All information on the right is
relevant for the current object only. Name of the current object is displayed at
the bottom. To change the current object press "Change" button and
select a different object in 3D. Clicking outside any object will make the
selection empty in which case all controls on the right will be disabled. 
Simplex sub menu performs delete or divide operations. 
The Shading check box in Render group allows rendering the surface in variable 
    application defined color 
Implementation
All implementation is contained in the main form class named Morph. 
Information about the mesh geometry is obtained via meshing interfaces IMesh,
IMeshEx
 and IIterator
 in range of Update..() methods starting from
UpdateModelInfo() method. 
Drawing of the current simplex, vertex and normal is done in OnClientDraw()
handler for the ClientDraw DG Kernel control event. This event is requested on
load via method RequestClientDraw of the control. Actual drawing is performed
with the help of IDraw
 interface. 
The application obtains the current object of the model via GetCurrentObject
method of IModel2 interface. To enable highlighting of the current object there
is a call to IView2.Enable  method in SetupView(). 
To allow user changing the current object OnChangeCurObject method calls 
IViewModal.SetViewMode  to change the current control mode from default
"View" to "Modal".
Selection of a different object in 3D view triggers a DG Kernel event, which is
captured in OnCurrentObjectChanged(). This method stores reference to the
selected  object passed via parameter, updates relevant information via
UpdateObjectInfo() and switches off modal mode to allow normal viewing. 
In this application "ModelPath" property of the DG Kernel control is
an empty string, which means
that no model is loaded on start of the application. Instead this sample
demonstrates dynamic creation of Meshed object and dynamic creation of its
surface via IMeshTopol interface. It is one in CreateDefault() method. 
The Shading check box is handled by OnShading() method which uses
        IMeshShading_KC 
    interface 
  
                 |