Tcl Library Source Code

Check-in [de82c45509]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Added special case for coincident points in spatial interpolation
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: de82c45509102fce7849e0423b93d61eabf0bcd6
User & Date: markus 2013-12-20 12:31:40
Context
2014-01-06
18:23
Re-join split trunk check-in: dfdc7799cc user: andreask tags: trunk
2013-12-20
12:31
Added special case for coincident points in spatial interpolation check-in: de82c45509 user: markus tags: trunk
2013-12-18
17:56
Merged pt work. check-in: 37f7976d5a user: aku tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to modules/math/ChangeLog.





1
2
3
4
5
6
7



2013-12-17  Andreas Kupries  <[email protected]>

	* decimal.man: Fixed missing requirement of the package
	* machineparameters.man: itself.

2013-11-03  Arjen Markus <[email protected]>

>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
2013-12-20  Arjen Markus <[email protected]>
	* interpolate.tcl: [Ticket 843c2257d2] Added special case for points coincident with the data points
	* interpolate.test: [Ticket 843c2257d2] Added test case for coincident points

2013-12-17  Andreas Kupries  <[email protected]>

	* decimal.man: Fixed missing requirement of the package
	* machineparameters.man: itself.

2013-11-03  Arjen Markus <[email protected]>

Changes to modules/math/interpolate.tcl.

377
378
379
380
381
382
383











384
385
386
387
388
389
390
   }

   foreach point $xyvalues {
      set dist 0.0
      foreach c [lrange $point 0 end-1] cc $coord {
         set dist [expr {$dist+($c-$cc)*($c-$cc)}]
      }











      if { $max_radius2 == {} || $dist <= $max_radius2 } {
         if { $inv_dist_pow == 1 } {
            set dist [expr {sqrt($dist)}]
         }
         set total_weight [expr {$total_weight+1.0/$dist}]

         set idx 0






>
>
>
>
>
>
>
>
>
>
>







377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
   }

   foreach point $xyvalues {
      set dist 0.0
      foreach c [lrange $point 0 end-1] cc $coord {
         set dist [expr {$dist+($c-$cc)*($c-$cc)}]
      }

      #
      # Take care of coincident points
      #
      if { $dist == 0.0 } {
          return [lindex $point end]
      }

      #
      # The general case
      #
      if { $max_radius2 == {} || $dist <= $max_radius2 } {
         if { $inv_dist_pow == 1 } {
            set dist [expr {sqrt($dist)}]
         }
         set total_weight [expr {$total_weight+1.0/$dist}]

         set idx 0

Changes to modules/math/interpolate.test.

208
209
210
211
212
213
214












215
216
217
218
219
220
221
            [::math::interpolate::interp-spatial $xyzvalues $coord]]
   }
   set result
} -result { 0.0       0.0
            0.0       0.0
            1.2      -0.6
            0.039996 -0.019998 }













#
# Test TODO: parameters for spatial interpolation
#

test interpolate-5.1 "neville algorithm" \
    -body {






>
>
>
>
>
>
>
>
>
>
>
>







208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
            [::math::interpolate::interp-spatial $xyzvalues $coord]]
   }
   set result
} -result { 0.0       0.0
            0.0       0.0
            1.2      -0.6
            0.039996 -0.019998 }

test "Interpolate-4.3" "Spatial interpolation - 3 - coincident points" \
   -match numbers -body {
   set result {}

   set xyzvalues { {-1.0 0.0 { -2.0  1.0 } }
                   { 1.0 0.0 {  2.0 -1.0 } } }
   set coord {-1.0 0.0}
      set result [::math::interpolate::interp-spatial $xyzvalues $coord]

   set result
} -result { -2.0 1.0 }

#
# Test TODO: parameters for spatial interpolation
#

test interpolate-5.1 "neville algorithm" \
    -body {