Mercurial > hg > dmlib
annotate dmlerp.c @ 300:4972ca91d062
Cleanups.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 11 Oct 2012 17:55:15 +0300 |
parents | 72813cece1ba |
children |
rev | line source |
---|---|
0 | 1 #include "dmlib.h" |
2 | |
3 void dmLerpInit(DMLerpContext *ctx, DMFloat start, DMFloat end, DMFloat nsteps) | |
4 { | |
5 ctx->start = start; | |
6 ctx->end = end; | |
7 ctx->nsteps = nsteps; | |
8 } | |
9 | |
10 | |
108
72813cece1ba
Move some lerp functions to the header as static inline functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
11 DMFloat dmCatmullRom(const DMFloat t, const DMFloat p0, const DMFloat p1, const DMFloat p2, const DMFloat p3) |
0 | 12 { |
13 const DMFloat q = t * t; | |
14 return ( | |
15 (2 * p1) + | |
16 (-p0 + p2) * t + | |
17 (2 * p0 - 5 * p1 + 4 * p2 - p3) * q + | |
18 ( -p0 + 3 * p1 - 3 * p2 + p3) * q * t | |
19 ) * 0.5f; | |
20 } |