Example 13d: Generating a centreline for a surface mesh

This example uses the centreline command to create a line of data points along the centre of mass of a tubular surface mesh.

The data points are generated along the axial xi direction (xi 2) beginning from the start element 1. The number of axis divisions is set to 2 which means two points will be generated along each axial element. Each centreline point is calculated by determining the centre of mass for a curve in the circumferential xi direction (xi 1). The generated points are stored in the same region as the surface mesh and can then be listed or exported.

Note that gaussian quadrature assuming cubic elements is used to calculate the centre of mass points. If cubic elements are used in the circumferential direction then the calculation is exact, otherwise the data points will only be an approximation to the centre of mass.

The view_centreline.com file can be used with cmgui to view the original surface mesh and the generated data points.

Once the data points have been generated a mesh of the line can be created by using the cmgui command gfx snake or by fitting an initial line mesh to the data.


The comfile run by this example is as follows:

# Create a centreline of data points for a surface mesh

# Author: Peter Bier
fem def param;r;$example/tract
# define a rectangular cartesian 3D coordinate system
fem def coord 3,1
# define a bi-cubic hermite basis function for the surface elements
# and a linear lagrange basis for using to interpolate along the circumference
# to calculate the centre of mass.
fem def base;r;$example/tract
# read in the surface mesh node points
fem def node;r;$example/tract
# read in the surface mesh element points
fem def elem;r;$example/tract

# Calculate the centreline data points
# default values for the axial and circumferential xi directions are used
# The default starting element number 1 is also used.
# 2 points will be generated for each element along the axial direction
fem def data;c centreline axis_divisions 2

# list the created data points
fem list data

# export the created data points for viewing
fem export data;centreline

# a centreline mesh can now be created by:
# using the cmgui command gfx snake
# or fitting a line to the data


Files used by this example are:

Name                 Modified     Size

example_13d.com 27-Mar-2003 1.0k centreline.exdata 20-Mar-2003 1.7k centreline.ipdata 20-Mar-2003 14k tract.exelem 20-Mar-2003 49k tract.exnode 20-Mar-2003 27k tract.ipbase 27-Mar-2003 2.3k tract.ipelem 20-Mar-2003 25k tract.ipnode 20-Mar-2003 73k tract.ippara 27-Mar-2003 5.9k view_centreline.com 20-Mar-2003 390

Download the entire example:

Name                      Modified     Size

examples_1_13_13d.tar.gz 18-Aug-2006 42k

Testing status by version:

StatusTestedReal time (s)
i686-linux
cmSuccessSun Mar 6 00:01:32 20160
cm-debugSuccessSat Mar 5 00:01:52 20160
mips-irix
cmSuccessSun Aug 19 01:24:05 20074
cm-debugSuccessWed Aug 15 01:21:13 20075
cm-debug-clear-mallocSuccessSat Aug 18 01:23:10 20078
cm-debug-clear-malloc7SuccessMon Aug 20 01:21:05 20078
cm64SuccessSun Aug 19 01:24:26 20072
cm64-debugSuccessTue Aug 21 01:20:34 20075
cm64-debug-clear-mallocSuccessThu Apr 1 10:10:10 20043
rs6000-aix
cmSuccessWed Mar 4 01:06:47 20091
cm-debugSuccessMon Mar 2 01:06:14 20091
cm64SuccessWed Mar 4 01:06:47 20090
cm64-debugSuccessTue Mar 3 01:11:34 20091
x86_64-linux
cmSuccessSun Mar 6 00:01:00 20160
cm-debugSuccessSat Mar 5 00:01:11 20160

Testing status by file:


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

Input last modified: Thu Mar 27 09:03:04 2003


CMISS Help / Examples / 1 / 13 / 13d