2009-10-09 Chris Toshok <toshok@ximian.com>
[moon.git] / src / moon-curves.h
blobbbb844b362ef3e699bf5a62cf199082c1551f1ef
1 /*
2 * moon-curves.h: A set of primitives + alghos for solving Y at X problmem
3 * for cubic curves. This is used ONLY for KeySpline animation,
4 * not used in any way for drawing.
6 * Contact:
7 * Moonlight List (moonlight-list@lists.ximian.com)
9 * Copyright 2007 Novell, Inc. (http://www.novell.com)
11 * See the LICENSE file included with the distribution for details.
15 #ifndef __MOON_CURVES_H__
16 #define __MOON_CURVES_H__
18 #include <math.h>
19 #include <glib.h>
21 G_BEGIN_DECLS
23 typedef struct
25 double x;
26 double y;
27 } moon_point;
29 typedef struct
31 moon_point c0;
32 moon_point c1;
33 moon_point c2;
34 moon_point c3;
35 } moon_cubic;
37 typedef struct
39 moon_point c0;
40 moon_point c1;
41 moon_point c2;
42 } moon_quadratic;
44 void moon_quadratic_from_cubic (moon_quadratic *dest, moon_cubic *src);
45 double moon_quadratic_y_for_x (double x, moon_quadratic *src);
46 double moon_quadratic_array_y_for_x (moon_quadratic *qarr, double x, int count);
47 void moon_convert_cubics_to_quadratics (moon_quadratic *dest_array, moon_cubic *src_array, int count);
48 void moon_subdivide_cubic (moon_cubic *dest1, moon_cubic *dest2, moon_cubic *src);
49 void moon_subdivide_cubic_at_level (moon_cubic *b, int lvl, moon_cubic *src);
51 G_END_DECLS
53 #endif