points_approx.tcl

This example shows how one goes from randomly spaced data points to an evenly sampled surface. We have 13504 approximation points (file examples/surfit/points/points.txt) and equidistant grid with more than 250000 nodes. To approximate points to evenly sampled smooth surface we do the following things:
See also:
points, points_add, completer
Here is the image of the resulting surface:

approximation surface

Pic 1. approximation surface

small part of approximation surface

Pic 2. small part of approximation surface

This result was obtained with "examples/surfit/points/points_approx.tcl" script.

Some comments to script:

00001 #
00002 # This script was generated with funner v2.1beta (www.gridding.info)
00003 
00004 # 
00005 # load plugins
00006 # 
00007 load libsurfit[info sharedlibextension]
00008 
00009 # remove all previous data and gridding rules
00010 clear_data 
00011 
00012 # set name of surface
00013 set map_name "map_points_approx" 
00014 
00015 # set tolerance for cg solver
00016 set tol 1e-006 
00017 
00018 ##
00019 ## load initial data 
00020 ##
00021  
00022 # load points from text file 
00023 pnts_read "points.txt" "points"  
00024  
00025 ##
00026 ## construct grid 
00027 ##
00028 grid 150 150 
00029  
00030 ##
00031 ## create gridding rules
00032 ##
00033 
00034 # resulting surface should tend to be constant or plane 
00035 completer 1 2  
00036 
00037 # add "resulting surface at points = points values" with weight 
00038 points_add 0.6 "points" 
00039 
00040 ##
00041 ## run gridding algorithm
00042 ##
00043 surfit 
00044 
00045 ##
00046 ## save results 
00047 ##
00048 
00049 # unload grid from memory
00050 grid_unload 
00051 
00052 # save surface to surfit datafile 
00053 surf_save "points_approx.dat" "map_points_approx" 



surfit: open source gridding and contouring software.