/**
* @file
* @brief Bernstein-Bezier polynomial
*//*
* Authors:
* MenTaLguY <mental@rydia.net>
* Michael Sloan <mgsloan@gmail.com>
* Nathan Hurst <njh@njhurst.com>
* Krzysztof KosiĆski <tweenk.pl@gmail.com>
*
* Copyright 2007-2015 Authors
*
* modify it either under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation
* (the "LGPL") or, at your option, under the terms of the Mozilla
* Public License Version 1.1 (the "MPL"). If you do not alter this
* notice, a recipient may use your version of this file under either
* the MPL or the LGPL.
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
* the specific language governing rights and limitations.
*
*/
#ifndef LIB2GEOM_SEEN_BEZIER_H
#define LIB2GEOM_SEEN_BEZIER_H
#include <algorithm>
#include <valarray>
#include <boost/optional.hpp>
/** @brief Compute the value of a Bernstein-Bezier polynomial.
* This method uses a Horner-like fast evaluation scheme.
* @param t Time value
* @param c_ Pointer to coefficients
* @param n Degree of the polynomial (number of coefficients minus one) */
double u = 1.0 - t;
for(unsigned i=1; i<n; i++){
}
}
/** @brief Perform Casteljau subdivision of a Bezier polynomial.
* Given an array of coefficients and a time value, computes two new Bernstein-Bezier basis
* polynomials corresponding to the \f$[0, t]\f$ and \f$[t, 1]\f$ intervals of the original one.
* @param t Time value
* @param v Array of input coordinates
* @param left Output polynomial corresponding to \f$[0, t]\f$
* @param right Output polynomial corresponding to \f$[t, 1]\f$
* @param order Order of the input polynomial, equal to one less the number of coefficients
* @return Value of the polynomial at @a t */
// The Horner-like scheme gives very slightly different results, but we need
// the result of subdivision to match exactly with Bezier's valueAt function.
return val;
}
if (!right) {
if (left != v) {
}
}
}
}
if (right != v) {
}
if (left) {
}
}
}
if (left) {
}
return right[0];
}
/**
* @brief Polynomial in Bernstein-Bezier basis
* @ingroup Fragments
*/
> >
{
void
double l, double r) const;
{}
Bezier() {}
}
return *this;
}
struct Order {
unsigned order;
};
//Construct an arbitrary order bezier
}
/// @name Construct Bezier polynomials from their control points
/// @{
}
}
}
}
}
}
}
}
}
}
}
}
{}
/// @}
}
void clear() {
}
//IMPL: FragmentConcept
for(unsigned i = 0; i <= order(); i++) {
}
return true;
}
for(unsigned i = 1; i <= order(); i++) {
}
return true;
}
bool isFinite() const {
for(unsigned i = 0; i <= order(); i++) {
}
return true;
}
}
// The size of the returned vector equals n_derivs+1.
Bezier forward_difference(unsigned k) const;
Bezier elevate_degree() const;
Bezier reduce_degree() const;
// basic arithmetic operators
c_ += v;
return *this;
}
c_ -= v;
return *this;
}
c_ *= v;
return *this;
}
c_ /= v;
return *this;
}
};
return result;
}
for(unsigned i = 0; i <= a.order(); i++)
return result;
}
// XXX Todo: how to handle differing orders
for(unsigned i = 0; i <= a[0].order(); i++) {
Point p;
for(unsigned d = 0; d < 2; d++) p[d] = a[d][i];
}
return result;
}
os << "Bezier(";
for(unsigned i = 0; i < b.order(); i++) {
}
return os;
}
}
#endif // LIB2GEOM_SEEN_BEZIER_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:fileencoding=utf-8:textwidth=99 :