# Set the default tessellation to use 4 segments in each element direction.
# This command does not exist on older versions of cmgui. It is safe to ignore errors.
gfx define tessellation default minimum_divisions "4" refinement_factors "1";
#Tests reading in the heart, producing simple geometry from it and fibre
#oriented glyphs and streamlines. Also show iso-surfaces of lambda=0.75.
gfx read nodes example heart.exnode
gfx read elements example heart.exelem
gfx create material heart ambient 0.5 0 0.2 diffuse 1 0 0 specular 0.5 0.5 0.5 shininess 0.5
gfx create material green ambient 0 0.4 0 diffuse 0 1 0.2 specular 0.4 0.4 0.4 shininess 0.5
gfx create material blue ambient 0 0 0.5 diffuse 0 0.3 1.0 specular 0.4 0.4 0.4 shininess 0.4
gfx create material gold ambient 1 0.4 0 diffuse 1 0.7 0 specular 0.5 0.5 0.5 shininess 0.8
gfx create material silver ambient 0.4 0.4 0.4 diffuse 0.7 0.7 0.7 emission 0 0 0 specular 0.7 0.7 0.7 alpha 1 shininess 0.6
gfx modify g_element "/" general clear;
gfx modify g_element "/" lines subgroup heart material default;
gfx modify g_element heart surfaces exterior face xi3_0 material heart
gfx define field fibre_axes fibre_axes coordinate coordinates fibre fibres
# rearrange the fibres_axes to be in order sheet,-fibre,normal so can track normal
# to fibres in plane of sheet:
gfx define field fibre composite fibre_axes.1 fibre_axes.2 fibre_axes.3
gfx define field sheet composite fibre_axes.4 fibre_axes.5 fibre_axes.6
gfx define field normal composite fibre_axes.7 fibre_axes.8 fibre_axes.9
gfx define field neg_fibre scale field fibre scale_factors -1 -1 -1
gfx define field fibre_sheet_axes composite sheet neg_fibre normal
# extract the components of the prolate coordinate field as scalar fields:
gfx define field lambda component coordinates.lambda
gfx define field mu component coordinates.mu
gfx define field theta component coordinates.theta
gfx modify g_element heart lines coordinate coordinates select_on material default selected_material default_selected;
# The following show different versions of fibres on sides of xi1=0/1 surfaces.
gfx mod g_e heart element_points mat blue use_faces face xi1_0 glyph sheet size "2*1*0.4" orientation fibre_axes scale_factors 0 disc 2
gfx mod g_e heart element_points mat green use_faces face xi1_1 glyph sheet size "2*1*0.4" orientation fibre_axes scale_factors 0 disc 2
# Track gold streamlines along fibres, silver along fibre normal in the plane
# of the sheet. Draw as a ribbon, flat side showing the fibre sheet.
gfx modify g_element heart streamlines xi 0.5 0.5 0.5 ribbon vector fibre_axes length 20 width 1 no_data material gold
gfx modify g_element heart streamlines xi 0.5 0.5 0.5 ribbon vector fibre_sheet_axes length 20 width 1 no_data material silver
# Export the scene graph
gfx export vrml file heart.wrl
# Test iso-surfaces.
gfx modify g_element heart iso_surfaces iso_scalar lambda iso_value 0.65 material default as "iso";
gfx define graphics_filter iso_only match_graphic_name iso;
gfx define scene heart_iso filter iso_only;
gfx export vrml file heart_iso_lambda.wrl scene heart_iso;