CG_Labs  2021.2
Functions
interpolation Namespace Reference

Functions

glm::vec3 evalLERP (glm::vec3 const &p0, glm::vec3 const &p1, float const x)
 Linearly interpolate a position between two points. More...
 
glm::vec3 evalCatmullRom (glm::vec3 const &p0, glm::vec3 const &p1, glm::vec3 const &p2, glm::vec3 const &p3, float const t, float const x)
 Compute a new position using a Catmull-Rom spline interpolation. More...
 

Function Documentation

◆ evalCatmullRom()

glm::vec3 interpolation::evalCatmullRom ( glm::vec3 const &  p0,
glm::vec3 const &  p1,
glm::vec3 const &  p2,
glm::vec3 const &  p3,
float const  t,
float const  x 
)
Parameters
[in]p0$p[i-1]$
[in]p1$p[i]$
[in]p2$p[i+1]$
[in]p3$p[i+2]$
[in]ttension
[in]xdistance ratio between p1 and p2 at which the interpolated point should be:
  • x == 0.0: result will be p0;
  • x == 1.0: result will be p1;
  • x == 0.5: result will be the midpoint of [p0,p1]
  • x ∈ ]0,1[: result will be somewhere on ]p0,p1[
Returns
interpolated position
Todo:
Implement this function

◆ evalLERP()

glm::vec3 interpolation::evalLERP ( glm::vec3 const &  p0,
glm::vec3 const &  p1,
float const  x 
)
Parameters
[in]p0origin point for the interpolation
[in]p1destination point for the interpolation
[in]xdistance ratio between p0 and p1 at which the interpolated point should be:
  • x == 0.0: result will be p0;
  • x == 1.0: result will be p1;
  • x == 0.5: result will be the midpoint of [p0,p1]
  • x ∈ ]0,1[: result will be somewhere on ]p0,p1[
Returns
interpolated position
Todo:
Implement this function