sbasis-2d.h revision 76addc201c409e81eaaa73fe27cc0f79c4db097c
/**
* \file
* \brief Obsolete 2D SBasis function class
*//*
* Authors:
* Nathan Hurst <?@?.?>
* JFBarraud <?@?.?>
*
* Copyright 2006-2008 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_SBASIS_2D_H
#define LIB2GEOM_SEEN_SBASIS_2D_H
#include <vector>
#include <cassert>
#include <algorithm>
#include <iostream>
/*
u 0,1
v 0,2
*/
double a[4];
Linear2d() {
a[0] = 0;
a[1] = 0;
a[2] = 0;
a[3] = 0;
}
for(unsigned i = 0 ; i < 4; i ++)
a[i] = aa;
}
{
a[0] = a00;
a[1] = a01;
a[2] = a10;
a[3] = a11;
}
double operator[](const int i) const {
assert(i >= 0);
assert(i < 4);
return a[i];
}
double& operator[](const int i) {
assert(i >= 0);
assert(i < 4);
return a[i];
}
double apply(double u, double v) {
return (a[0]*(1-u)*(1-v) +
a[1]*u*(1-v) +
a[2]*(1-u)*v +
a[3]*u*v);
}
};
return Linear(a[0]*(1-u) +
a[1]*u,
a[2]*(1-u) +
a[3]*u);
}
return Linear(a[0]*(1-v) +
a[2]*v,
a[1]*(1-v) +
a[3]*v);
}
return Linear2d(-a.a[0], -a.a[1],
-a.a[2], -a.a[3]);
}
return Linear2d(a[0] + b[0],
a[1] + b[1],
a[2] + b[2],
a[3] + b[3]);
}
return Linear2d(a[0] - b[0],
a[1] - b[1],
a[2] - b[2],
a[3] - b[3]);
}
for(unsigned i = 0; i < 4; i++)
a[i] += b[i];
return a;
}
for(unsigned i = 0; i < 4; i++)
a[i] -= b[i];
return a;
}
for(unsigned i = 0; i < 4; i++)
a[i] *= b;
return a;
}
for(unsigned i = 0; i < 4; i++)
if(a[i] != b[i])
return false;
return true;
}
for(unsigned i = 0; i < 4; i++)
if(a[i] == b[i])
return false;
return true;
}
return Linear2d(a*b[0], a*b[1],
a*b[2], a*b[3]);
}
// vector in u,v
SBasis2d() {}
}
}
return Linear2d(0);
return Linear2d(0);
}
double apply(double u, double v) const {
double s = u*(1-u);
double t = v*(1-v);
Linear2d p;
double tk = 1;
// XXX rewrite as horner
double sk = 1;
sk *= s;
}
tk *= t;
}
return p.apply(u,v);
}
void clear() {
}
void normalize(); // remove extra zeros
double tail_error(unsigned tail) const;
void truncate(unsigned k);
};
for(unsigned i = 0; i < p.size(); i++) {
}
return result;
}
}
}
return result;
}
}
}
return result;
}
if(a.size() < 1)
a.push_back(b);
else
a[0] += b;
return a;
}
if(a.size() < 1)
a.push_back(-b);
else
a[0] -= b;
return a;
}
if(a.size() < 1)
else {
for(unsigned i = 0; i < 4; i++)
a[0] += double(b);
}
return a;
}
if(a.size() < 1)
else {
a[0] -= b;
}
return a;
}
for(unsigned i = 0; i < a.size(); i++)
a[i] *= b;
return a;
}
for(unsigned i = 0; i < a.size(); i++)
a[i] *= (1./b);
return a;
}
// return a kth order approx to 1/a)
// a(b(t))
// these two should probably be replaced with compose
return out_file;
}
for(unsigned i = 0; i < p.size(); i++) {
}
return out_file;
}
} // end namespace Geom
#endif
/*
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 :