Example c3: Viewing a skull


The comfile run by this example is as follows:

Example_c3  Viewing the skull

#This example reads skull node and element files into
#CMISS, and then exports them in a suitable format for 
#CMGUI.  The exported files are then read into CMGUI and
#the skull is displayed.  Note that this problem requires
#a large parameter set for CMISS.  A suitable 
#parameters.inc file is given in the doc directory for
#this example.

#.exnode and .exelem files are also contained in this 
#directory, so that the skull may be viewed without  
#first exporting the elements. 

#export the finite elements
fem                                     #sets the environment to FEM
fem define coordinate;r;view_skull;example  #defines 3D rectangular 
#                                       !  coordinates
fem define bases;r;example                  #defines 1 bicubic Hermite BEM basis
fem define nodes;r;example                  #defines the geometry
fem define elements;r;example          
fem export node as full_skull           #exports the data to CMGUI with the
fem export elem as full_skull           #  group named 'full_skull'

#draw the skull using CMGUI
gfx                                     #sets the environment to GFX
gfx create window                       #creates a 3D window
gfx modify lmodel default ambient 0.3 0.3 0.3 #adds ambient light to the
#                                       !  scene
gfx modify light default direction 0.5 0.5 2.0 #modifies the direction
gfx create light back_top colour 0.3 0.3 0.3 direction -1.0 -0.3 0.2
#                                       !creates another light
gfx create material bone ambient 0.5 0.5 0.5 diffuse 1.00 0.92 0.67 specular 0.87 0.85 0.92 shininess 0.85
#                                       !creates material that looks like bone
gfx create material line diffuse 0.00 0.00 0.00 #creates a material
#                                       !  that is black
gfx read node doc view_skull            #reads in the exported data
gfx read elem doc view_skull
gfx create surface from full_skull as full_skull_surface with 5*5 material bone
#                                       !creates a surface from the finite 
#                                       !  elements named 'full_skull_surface'
#                                       !  with a discretisation of 25 patches
#                                       !  per element
gfx create line from full_skull as full_skull_line with 5 material line
#                                       !creates a set of lines from the finite 
#                                       !  elements named 'full_skull_line'
#                                       !  with a discretisation of 5 line 
#                                       !  segments per element line
gfx draw surface name full_skull_surface #draws the surface on the 3D window
gfx draw line name full_skull_line      #draws the line on the 3D window
gfx set interest_point 90.0 0.0 0.0     #looks at the center of the skull
gfx set view_point -500.0 0.0 0.0       #looks from a reasonable distance away
#                                       !  from the skull
gfx update                              #displays the skull 

Files used by this example are:

Name               Modified     Size

example_c3.com 10-Apr-2000 3.1k parameters.inc 10-Apr-2000 6.7k view_skull.exelem 10-Apr-2000 104k view_skull.exnode 10-Apr-2000 53k view_skull.ipbase 10-Apr-2000 3.8k view_skull.ipcoor 10-Apr-2000 568 view_skull.ipelem 10-Apr-2000 58k view_skull.ipnode 10-Apr-2000 130k

Download the entire example:

Name                  Modified     Size

examples_c_c3.tar.gz 19-Aug-2006 44k

Html last generated: Sun Mar 6 05:51:17 2016

Input last modified: Wed Jun 12 09:11:36 2002


CMISS Help / Examples / c / c3