Shows how to create embedded Element Xi nodes in the front end. Then error vectors showing the distance from the embedded point to element_xi point can be generated. These will interactively update whenever the host mesh is adjusted.
#Example_ap: Element Xi Coordinates : Fitting a face to a fox # # This example shows how to convert ipxi to cmgui elementxi, an example of # converting exnode and exelem to ipnode and ipelem (this is not generic # unfortunately), some fitting with cmiss, # #---------- # set dir example ap # gfx create material aqua_blue ambient 0.1 0.9 1 diffuse 0.1 0.9 1 emission 0 0 0 specular 0.8 0.8 0.8 alpha 1 shininess 0.8 gfx create material jade ambient 0.1 0.56 0 diffuse 0.1 0.39 0 emission 0 0 0 specular 0.8 0.8 0.8 alpha 1 shininess 0.8 gfx create material purple ambient 0.72 0 1 diffuse 0.5 0 1 emission 0 0 0 specular 1 1 1 alpha 1 shininess 0.8 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 if (!$TESTING) { gfx create window 1; gfx modify window 1 view parallel eye_point 360.515 -98.2134 593.377 interest_point 27.6929 18.9214 48.7295 up_vector 0.0456354 0.981996 0.183306 view_angle 41.4883 near_clipping_plane 6.48947 far_clipping_plane 2319.12 relative_viewport ndc_placement -1 1 2 2 viewport_coordinates 0 0 1 1; } # # Read in the four cubic elements in which we will embed our mesh gfx read nodes example host.exnode gfx read elements example host.exelem # gfx modify g_element host general clear; gfx modify g_element host lines coordinate coordinates material default; # # Read in the embedded face mesh in its original position. gfx read nodes example new_source.exnode gfx read elements example new_mesh.exelem gfx modify g_element mesh general clear; gfx modify g_element mesh lines coordinate coordinates material default; gfx modify g_element mesh surfaces coordinate coordinates material jade; gfx modify g_element mesh node_points coordinate coordinates glyph sphere size "5*5*5" centre 0,0,0 no_select material purple; # # Calculate xi positions for each of these embedded nodes. # This will be done in cm. The host mesh was converted to ipnode # and ipelem using the fortran program ex2ip. This program is available # here but makes many assumptions about the file structure, specifically # the number of derivatives and where some of the spaces are. # It can usually be modified to work with other exnode and exelem files. # The new_source nodes must be converted to ipdata. This was done with the # fortran program ex2ipdata. # Now we can run cmiss to calculate the xi points. gfx create cmiss set dir example ap open comfile example anthro_xi.com exec # This generates a file called face.ipxi # # By converting this file to element xi we can graphically visualise the # error between the xi positions and the data positions. An awk script # is available here to convert ipxi to and exnode or exdata file which # can be read in. system "awk -f $example/ipxi2ex.awk < face.ipxi > face_xi.exnode" # gfx read nodes face_xi.exnode # Now each of the embedded nodes has two 3D coordinates. An explicit # original coordinate and an element_xi_coordinate. By drawing a line # between these positions we get to see the error. Because we just # calculated the xi's there shouldn't be any error at this point. # # In addition, read in a third coordinate at the target positions, then we can # interactively see the error in the fit represented as red lines. gfx read nodes example new_target.exnode gfx define field error coordinate_system rectangular_cartesian add fields target_coordinates element_xi_coordinate scale_factors 1 -1 gfx modify g_element mesh node_points glyph line size "0*1.8*1.8" centre 0,0,0 orientation error scale_factors "1*0*0" no_select material red # # If we edit the positions of the host mesh the error vectors update. gfx modify g_element host node_points glyph sphere size "5*5*5" centre 0,0,0 select_on material aqua_blue # Now choose select mode in the graphics window and drag the host mesh nodes. # # We can use cmiss to calculate an optimal host mesh. gfx create cmiss set dir example ap open comfile example anthro_fit.com exec gfx read node host_fit.exnode # # The error vectors update with the host mesh. You can see how difficult it was # to fit around the snout. Element_xi coordinates cannot be interpolated by # elements like normal nodes, to draw the lines and elements at the fitted # positions the actual coordinates of the element_xi nodes must be explicitly # calculated and stored as real numbers. gfx evaluate ngroup mesh source element_xi_coordinate destination coordinates # # So what? Wasn't that a very complicated way to move the nodes? # True but now we have a mapping from the first face to the second so # can update a high res version of the first face to approximate the second, # or if we had a standard human body model we can fit some important markers # measured on a specific individual, fit to those and then update the whole # model to approximate that individual. # gfx
Name Modified Size
example_ap.com 17-Mar-2014 4.7k COPYRIGHT 17-Mar-2014 504 anthro_fit.com 17-Mar-2014 833 anthro_xi.com 17-Mar-2014 479 ex2ip 17-Mar-2014 21k ex2ip.f 17-Mar-2014 5.5k ex2ip2.f 17-Mar-2014 5.5k ex2ipdata 17-Mar-2014 16k ex2ipdata.f 17-Mar-2014 2.7k face.exdata 17-Mar-2014 8.4k face.ipxi 17-Mar-2014 7.8k face_xi.exnode 17-Mar-2014 8.5k host.com 17-Mar-2014 298 host.exelem 17-Mar-2014 9.2k host.exnode 17-Mar-2014 5.9k host.ipbase 17-Mar-2014 6.0k host.ipcoor 17-Mar-2014 588 host.ipelem 17-Mar-2014 1.5k host.ipelfd 17-Mar-2014 1.1k host.ipfiel 17-Mar-2014 16k host.ipmesh 17-Mar-2014 1.0k host.ipnode 17-Mar-2014 3.9k host_fit.exelem 17-Mar-2014 12k host_fit.exnode 17-Mar-2014 11k host_fit.ipfit 17-Mar-2014 1.9k ipxi2ex.awk 17-Mar-2014 314 new_mesh.exelem 17-Mar-2014 18k new_source.exnode 17-Mar-2014 4.1k new_source.ipdata 17-Mar-2014 4.7k new_target.exnode 17-Mar-2014 4.1k new_target.ipdata 17-Mar-2014 4.7k
Name Modified Size
examples_a_ap.tar.gz 09-Mar-2016 176k
Html last generated: Wed Mar 9 16:01:27 2016
Input last modified: Wed Mar 9 15:49:43 2016