Personal tools
You are here: Home / cmgui / Wiki / Glenn's notes
Navigation
Log in


Forgot your password?
 

Glenn's notes

Delete orphan nodes in cmgui

In cmgui selected nodes that are part of a mesh will not be deleted so just select all the nodes and delete them.

Generate a point cloud by sampling a mesh surface in cmgui

Load the surface mesh into cmgui. Create a field in cmgui:

# Adjust the parameter to vary the density, the value depends on the scale of the mesh.
gfx define field density coordinate_system rectangular_cartesian composite 1;

# make a point cloud on exterior faces (no need to specify exterior if 2-D mesh)
gfx modify g_element "/" element_points coordinate coordinates exterior glyph point use_faces cell_poisson density density;

# export as vrml
gfx export vrml file km.wrl

In order to get a uniform but sparse density mesh. Generate a dense Poisson distributed mesh in cmgui using the above method and then use MeshLab http://meshlab.sourceforge.net to decimate the point cloud.

E.g. http://fox-gieg.com/tutorials/2010/point-cloud-to-mesh/

To decimate the point cloud into a sparse uniformly spaced cloud

Open the exported .wrl file in Meshlab.

From the Filters menu choose Sampling->Poission-disk sampling

In the dialog:

enter the desired number of points
select "Base mesh subsampling"
click apply

The sampled points will be on a new layer.

Open the layers dialog and hide the original pointset.

From the File menu choose "Export mesh as..." and export as .PLY ascii

The points can then be either parsed or manually extracted from this file (the PLY format is a header followed by a list of point coordinates).

Convert the list of points to cm format using the CmConvert Perl utility.

Rebuild faces in cmgui

Use this function:

sub reface(){
  gfx destroy faces group "/" all
  gfx define faces egroup "/"
}