home dev games gallery work
Lewpen.com»Research & Development»3D Graphics»OpenGL»Reflective Sphere

Reflective Sphere

Analytical reflections in OpenGL

/ Source / common / 001 / interpolate.cpp

#include <math.h>
#include "interpolate.h"





//---- interpolateLinear

//  Basic linear interpolation

double interpolateLinear( double x1, double x2, double a )
{
  return x1*(1.0-a) + x2*a;
}





//---- interpolateSpringy

//  with a little wiggle at the end (portion of a sine wave, goes slightly above one, but ends at one)

double interpolateSpringy( double x1, double x2, double a )
{
  a = sin( a * 3.14159 * 0.25 * 2.6 ) / sin( 3.14159 * 0.25 * 2.6 );
  return x1*(1.0-a) + x2*a;
}
Related Articles

Procedural city block layout

Animated 4-dimensional objects mapped down to 3D

Simulating a cloth falling and slipping over objects

Windows C++ OpenGL example

Games

The Dodge Game
Flatspace

2-Player Games:

Quake 2D
Meteora

Puzzle Games:

Mini Tetris
Sudoku Solver

Development

3D Graphics:

3D Graphics Articles
WebGL Examples
OpenGL Examples
Flash 3D Engine
Java 3D Engine

Development:

Programming Articles
Game Development Examples

Work

Portfolio
Clients
Startups & Projects
Expertise

Links

CubeLogix Studios
PHP Charts & Graphs
Local Legends Football