1
#ifndef SEEN_GEOM_BEZIER_UTILS_H
2
#define SEEN_GEOM_BEZIER_UTILS_H
6
* \brief \todo brief description
8
* An Algorithm for Automatically Fitting Digitized Curves
9
* by Philip J. Schneider
10
* from "Graphics Gems", Academic Press, 1990
14
* Lauris Kaplinski <lauris@ximian.com>
16
* Copyright (C) 1990 Philip J. Schneider
17
* Copyright (C) 2001 Lauris Kaplinski and Ximian, Inc.
19
* This library is free software; you can redistribute it and/or
20
* modify it either under the terms of the GNU Lesser General Public
21
* License version 2.1 as published by the Free Software Foundation
22
* (the "LGPL") or, at your option, under the terms of the Mozilla
23
* Public License Version 1.1 (the "MPL"). If you do not alter this
24
* notice, a recipient may use your version of this file under either
25
* the MPL or the LGPL.
27
* You should have received a copy of the LGPL along with this library
28
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
29
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30
* You should have received a copy of the MPL along with this library
31
* in the file COPYING-MPL-1.1
33
* The contents of this file are subject to the Mozilla Public License
34
* Version 1.1 (the "License"); you may not use this file except in
35
* compliance with the License. You may obtain a copy of the License at
36
* http://www.mozilla.org/MPL/
38
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
39
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
40
* the specific language governing rights and limitations.
44
#include <2geom/point.h>
48
/* Bezier approximation utils */
49
Point bezier_pt(unsigned degree, Point const V[], double t);
51
int bezier_fit_cubic(Point bezier[], Point const data[], int len, double error);
53
int bezier_fit_cubic_r(Point bezier[], Point const data[], int len, double error,
54
unsigned max_beziers);
56
int bezier_fit_cubic_full(Point bezier[], int split_points[], Point const data[], int len,
57
Point const &tHat1, Point const &tHat2,
58
double error, unsigned max_beziers);
60
Point darray_left_tangent(Point const d[], unsigned const len);
61
Point darray_left_tangent(Point const d[], unsigned const len, double const tolerance_sq);
62
Point darray_right_tangent(Point const d[], unsigned const length, double const tolerance_sq);
64
template <typename iterator>
66
cubic_bezier_poly_coeff(iterator b, Point *pc) {
74
for(int i = 0; i < 4; i++) {
78
for(int i = 0; i < 4; i++) {
80
for(int j = 0; j <= i; j++) {
81
pc[3 - j] += c[cp]*(*b);
88
#endif /* !SEEN_GEOM_BEZIER_UTILS_H */
93
c-file-style:"stroustrup"
94
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
99
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :