Example a_backup/am: Node editing along coordinate axes : Editing the heart mesh

Shows how to use EDIT_MASK and CONSTANT computed fields to create arrow vectors that allow you to edit along the underlying coordinate system directions even in the 3D window.

Screenshot of example a_backup/am


The comfile run by this example is as follows:

#Example_am: Node editing along coordinate axes : Editing the heart mesh
#
# This example shows that by using EDIT_MASK and CONSTANT computed fields
# it is possible to make glyphs that allow you to shift nodes along
# the coordinate axes directions, greatly increasing your control when 
# graphically positioning nodes in the 3D window.
#
# This procedure is easy to generalise to any other coordinate system.
#
#----------
#
# Read in the heart mesh from examples a3.
set dir example a3
gfx read nodes example heart.exnode
gfx read elements example heart.exelem
#
# Define a few materials for the edit arrows
#
gfx create material red ambient 1 0 0 diffuse 1 0 0 emission 0 0 0 specular 0.8 0.8 0.8 alpha 1 shininess 0.8
gfx create material green ambient 0 0.6 0 diffuse 0 0.6 0 emission 0 0 0 specular 0.8 0.8 0.8 alpha 1 shininess 0.8
gfx create material bluey ambient 0 0.2 0.4 diffuse 0 0.5 1 emission 0 0 0 specular 0.5 0.5 0.5 alpha 1 shininess 0.8
gfx create material gold ambient 1 0.7 0 diffuse 1 0.7 0 emission 0 0 0 specular 1 1 0.8 alpha 1 shininess 0.8
gfx create material purple ambient 1 0 1 diffuse 1 0 1 emission 0 0 0 specular 1 1 1 alpha 1 shininess 0.74
#
# Define the computed fields which pass the full coordinates along unchanged
# but only allow selective editing.  The edit_mask is a series of flags so 
# you can make glyphs that drag in two coordinates but not the third by 
# specifying edit_mask 1 1 0.  The coordinate system is inherited from the
# source field which is in prolate spheroidal.  To use rectangular cartesian
# edit vectors on the heart override this inheritance by specifying the
# coordinate system here.
#
gfx define field edit.lambda edit_mask field coordinates edit_mask 1 0 0
gfx define field edit.mu edit_mask field coordinates edit_mask 0 1 0
gfx define field edit.theta edit_mask field coordinates edit_mask 0 0 1
#
# We need constant vectors so that the edit arrows point in the correct
# direction. These fields have no source to inherit the coordinate system from
# so we set it explicitly.
#
gfx define field lambda_dirn coordinate_system prolate_spheroidal focus 35.25 constant number_of_values 3 values 1 0 0
gfx define field mu_dirn coordinate_system prolate_spheroidal focus 35.25 constant number_of_values 3 values 0 1 0
gfx define field theta_dirn coordinate_system prolate_spheroidal focus 35.25 constant number_of_values 3 values 0 0 1
#
# Put glyphs at every heart node that allow us to select them
#
gfx modify g_element heart general clear;
gfx modify g_element heart lines coordinate coordinates material default;
gfx modify g_element heart node_points coordinate coordinates glyph sphere size "1*1*1" centre 0,0,0 select_on material green selected_material purple
#
# Create the edit arrows at each node only when selected, and display the
# current coordinates at these nodes.
#
gfx modify g_element heart node_points coordinate edit.lambda glyph arrow_solid size "5*1*1" centre 0,0,0 orientation lambda_dirn scale_factors "0*0*0" draw_selected material red selected_material red

gfx modify g_element heart node_points coordinate edit.mu glyph arrow_solid size "5*1*1" centre 0,0,0 orientation mu_dirn scale_factors "0*0*0" draw_selected material bluey selected_material bluey

gfx modify g_element heart node_points coordinate edit.theta glyph arrow_solid size "5*1*1" centre 0,0,0 orientation theta_dirn scale_factors "0*0*0" draw_selected material gold selected_material gold

#
# Create the window
#
gfx create window 1
gfx modify window 1 view parallel eye_point -29.38 287.425 79.9833 interest_point 9.70453 6.38585 -5.00082 up_vector -0.99086 -0.118078 -0.0652206 view_angle 19.9678 near_clipping_plane 2.96197 far_clipping_plane 1058.51 relative_viewport ndc_placement -1 1 2 2 viewport_coordinates 0 0 1 1
#
# Set up the node tool for editing
#
# Select the node tool icon in the graphics window. Click again on its icon and
# choose 'edit' on the dialog that appears.  Alternatively, enable node editing
# with the following command:
gfx node_tool edit
#
# Edit away!
#
# Click on some of the green spheres and the edit vectors appear.
# Drag the edit_vectors to move the nodes.  Each coloured edit_vector moves you
# in only one of the underlying coordinate directions.
# You can select multiple nodes and move groups together, again maintaining
# consistency in the underlying coordinate system. 
#

Files used by this example are:

Name            Modified     Size

example_am.com 20-Apr-2012 4.3k COPYRIGHT 19-Apr-2012 504

Download the entire example:

Name                         Modified     Size

examples_a_backup_am.tar.gz 12-Aug-2014 26k

Testing status by version:

StatusTestedReal time (s)
i686-linux
cmgui-wxSuccessSun Mar 6 00:14:56 20162
cmgui-wx-debugSuccessSun Mar 6 00:14:58 20162
cmgui-wx-debug-memorycheckSuccessSun Mar 6 00:12:13 20163
cmgui-wx-debug-valgrindFailureSun Mar 6 01:01:34 201639
last breakSun Mar 6 01:00:00 201639
last successTue Feb 10 00:51:00 201538
x86_64-linux
cmgui-wxFailureSun Mar 6 00:01:36 20160
last breakSun Mar 6 00:01:00 20160
last successWed Jun 3 00:04:00 20150
cmgui-wx-debugFailureSun Mar 6 00:01:36 20160
last breakSun Mar 6 00:01:00 20160
last successWed Jun 3 00:05:00 20151
cmgui-wx-debug-memorycheckFailureSun Mar 6 00:01:36 20160
last breakSun Mar 6 00:01:00 20160
last successWed Jun 3 00:05:00 20151
cmgui-wx-debug-valgrindFailureSun Mar 6 00:03:05 201610
last breakSun Mar 6 00:02:00 201610
last successWed Jun 3 00:28:00 201532
cmgui-wx-gcc-cad-debug-valgrindSuccessThu Jan 7 00:02:32 20167

Testing status by file:


Html last generated: Sun Mar 6 05:50:52 2016

Input last modified: Fri Apr 20 15:56:19 2012


CMISS Help / Examples / a_backup / am