bezier.h revision e6bdf746e2d9e775704a475a29cc1bb167ec271c
/*
* bezier.h
*
* Copyright 2007 MenTaLguY <mental@rydia.net>
* Copyright 2007 Michael Sloan <mgsloan@gmail.com>
* Copyright 2007 Nathan Hurst <njh@njhurst.com>
*
* 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 SEEN_BEZIER_H
#define SEEN_BEZIER_H
#include "coord.h"
#include <valarray>
#include "isnan.h"
#include "bezier-to-sbasis.h"
#include "d2.h"
#include "solver.h"
/* Copy control points */
/* Triangle computation */
for (unsigned i = 1; i <= order; i++) {
for (unsigned j = 0; j <= order - i; j++) {
}
}
for (unsigned j = 0; j <= order; j++)
for (unsigned j = 0; j <= order; j++)
}
//std::copy(c, c+order()+1, &c_[0]);
}
}
return *this;
}
struct Order {
unsigned order;
};
//Construct an arbitrary order bezier
}
}
//Construct an order-1 bezier (linear Bézier)
}
//Construct an order-2 bezier (quadratic Bézier)
}
//Construct an order-3 bezier (cubic Bézier)
}
//IMPL: FragmentConcept
typedef Coord output_type;
inline bool isZero() const {
for(unsigned i = 0; i <= order(); i++) {
if(c_[i] != 0) return false;
}
return true;
}
inline bool isFinite() const {
for(unsigned i = 0; i <= order(); i++) {
}
return true;
}
}
}
//Only mutator
/* This is inelegant, as it uses several extra stores. I think there might be a way to
* evaluate roughly in situ. */
for(unsigned i = 0; i < size(); i++)
}
}
return val_n_der;
}
}
return solutions;
}
};
//TODO: implement others
for(unsigned i = 0; i <= a.order(); i++)
result[i] = a[i] + v;
return result;
}
for(unsigned i = 0; i <= a.order(); i++)
result[i] = a[i] - v;
return result;
}
for(unsigned i = 0; i <= a.order(); i++)
result[i] = a[i] * v;
return result;
}
for(unsigned i = 0; i <= a.order(); i++)
result[i] = a[i] / v;
return result;
}
for(unsigned i = 0; i <= a.order(); i++)
return result;
}
//TODO: implement better?
if(from == 0) {
}
}
// 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;
}
for(unsigned i = 0; i < a.order(); i++) {
}
return der;
}
inte[0] = 0;
}
return inte;
}
}
//TODO: better bounds exact
return bounds_exact(b.toSBasis());
}
//return bounds_local(b.toSBasis(), i);
}
for(unsigned i = 0; i < b.size(); i++) {
out_file << b[i] << ", ";
}
return out_file;
}
}
#endif //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:encoding=utf-8:textwidth=99 :