def _cosine_components(a, b, g): # This guy is great http://paulbourke.net/miscellaneous/interpolation/ g2 = (1 - tf.cos(g * math.pi)) / 2 return a * (1 - g2), b * g2