R2 Shaders
Functions
R2Bilinear.h File Reference

Functions for performing bilinear interpolation. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

vec3 R2_bilinearInterpolate3 (const vec3 x0y0, const vec3 x1y0, const vec3 x0y1, const vec3 x1y1, const vec2 p)
 

Detailed Description

Functions for performing bilinear interpolation.

Definition in file R2Bilinear.h.

Function Documentation

§ R2_bilinearInterpolate3()

vec3 R2_bilinearInterpolate3 ( const vec3  x0y0,
const vec3  x1y0,
const vec3  x0y1,
const vec3  x1y1,
const vec2  p 
)

Bilinearly interpolate between the set of four vectors. Iff p == (0,0) then the function yields x0y0. Iff p == (1,1) then the function yields x1y1. Any intermediate values of p yield a bilinear mix of the four vectors.

Parameters
x0y0The upper left vector
x1y0The upper right vector
x0y1The lower left vector
x1y1The lower right vector
pThe interpolation vector

Definition at line 23 of file R2Bilinear.h.

29 {
30  vec3 u0 = mix (x0y0, x1y0, p.x);
31  vec3 u1 = mix (x0y1, x1y1, p.x);
32  return mix (u0, u1, p.y);
33 }