summaryrefslogtreecommitdiffstats
path: root/src/display/bezier-utils.h
blob: 1d6c8678f0de12a7e1847302942ceb3cca7d0497 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef __SP_BEZIER_UTILS_H__
#define __SP_BEZIER_UTILS_H__

/*
 * An Algorithm for Automatically Fitting Digitized Curves
 * by Philip J. Schneider
 * from "Graphics Gems", Academic Press, 1990
 *
 * Authors:
 *   Philip J. Schneider
 *   Lauris Kaplinski <lauris@ximian.com>
 *
 * Copyright (C) 1990 Philip J. Schneider
 * Copyright (C) 2001 Lauris Kaplinski and Ximian, Inc.
 *
 * Released under GNU GPL
 */

#include <libnr/nr-forward.h>
#include <glib/gtypes.h>

/* Bezier approximation utils */
NR::Point bezier_pt(unsigned degree, NR::Point const V[], gdouble t);

gint sp_bezier_fit_cubic(NR::Point bezier[], NR::Point const data[], gint len, gdouble error);

gint sp_bezier_fit_cubic_r(NR::Point bezier[], NR::Point const data[], gint len, gdouble error,
                           unsigned max_beziers);

gint sp_bezier_fit_cubic_full(NR::Point bezier[], int split_points[], NR::Point const data[], gint len,
                              NR::Point const &tHat1, NR::Point const &tHat2,
                              gdouble error, unsigned max_beziers);

NR::Point sp_darray_left_tangent(NR::Point const d[], unsigned const len);
NR::Point sp_darray_left_tangent(NR::Point const d[], unsigned const len, double const tolerance_sq);
NR::Point sp_darray_right_tangent(NR::Point const d[], unsigned const length, double const tolerance_sq);


#endif /* __SP_BEZIER_UTILS_H__ */

/*
  Local Variables:
  mode:c++
  c-file-style:"stroustrup"
  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
  indent-tabs-mode:nil
  fill-column:99
  End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :