bilinear <- function ( x, y, z, newx, newy ) #*****************************************************************************80 # ## bilinear evaluates a bilinear interpolant. # # Licensing: # # Copyright 2016 James P. Howard, II # # The computer code and data files on this web page are distributed under # https://opensource.org/licenses/BSD-2-Clause, the BSD-2-Clause license. # # Modified: # # 27 February 2020 # # Author: # # Original R code by James Howard; # Modifications by John Burkardt. # # Reference: # # James Howard, # Computational Methods for Numerical Analysis with R, # CRC Press, 2017, # ISBN13: 978-1-4987-2363-3. # { z1 <- ( x[2] - newx ) * z[1,1] + ( newx - x[1] ) * z[1,2] z1 <- z1 / ( x[2] - x[1] ) z2 <- ( x[2] - newx ) * z[2,1] + ( newx - x[1] ) * z[2,2] z2 <- z2 / ( x[2] - x[1] ) z <- ( y[2] - newy ) * z1 + ( newy - y[1] ) * z2 z <- z / ( y[2] - y[1] ) return ( z ) }