/**
* \file
* \brief Lifts one dimensional objects into 2D
*//*
* Authors:
* Michael Sloan <mgsloan@gmail.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, output 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_D2_H
#define LIB2GEOM_SEEN_D2_H
#include <iterator>
/**
* @brief Adaptor that creates 2D functions from 1D ones.
* @ingroup Fragments
*/
{
T f[2];
typedef T D1Value;
typedef T &D1Reference;
typedef T const &D1ConstReference;
D2() {f[X] = f[Y] = T();}
f[X] = T(a[X]); f[Y] = T(a[Y]);
}
D2(T const &a, T const &b) {
f[X] = a;
f[Y] = b;
}
}
typedef Point V;
}
//TODO: ask mental about operator= as seen in Point
T& operator[](unsigned i) { return f[i]; }
T const & operator[](unsigned i) const { return f[i]; }
return ret;
}
//IMPL: FragmentConcept
}
}
bool isFinite() const {
}
}
}
return (*this)(t);
}
// TODO: remove this alias
return (*this)(t);
}
y = f[Y].valueAndDerivatives(t, n); // always returns a vector of size n+1
for(unsigned i = 0; i <= n; i++) {
}
return res;
}
}
};
}
}
}
//IMPL: EqualityComparableConcept
inline bool
return a[0]==b[0] && a[1]==b[1];
}
inline bool
return a[0]!=b[0] || a[1]!=b[1];
}
//IMPL: NearConcept
inline bool
BOOST_CONCEPT_ASSERT((NearConcept<T>));
}
//IMPL: AddableConcept
inline D2<T>
D2<T> r;
for(unsigned i = 0; i < 2; i++)
r[i] = a[i] + b[i];
return r;
}
inline D2<T>
D2<T> r;
for(unsigned i = 0; i < 2; i++)
r[i] = a[i] - b[i];
return r;
}
inline D2<T>
for(unsigned i = 0; i < 2; i++)
a[i] += b[i];
return a;
}
inline D2<T>
for(unsigned i = 0; i < 2; i++)
a[i] -= b[i];
return a;
}
//IMPL: ScalableConcept
inline D2<T>
D2<T> r;
for(unsigned i = 0; i < 2; i++)
r[i] = -a[i];
return r;
}
inline D2<T>
D2<T> r;
for(unsigned i = 0; i < 2; i++)
r[i] = a[i] * b[i];
return r;
}
inline D2<T>
//TODO: b==0?
D2<T> r;
for(unsigned i = 0; i < 2; i++)
r[i] = a[i] / b[i];
return r;
}
inline D2<T>
for(unsigned i = 0; i < 2; i++)
a[i] *= b[i];
return a;
}
inline D2<T>
//TODO: b==0?
for(unsigned i = 0; i < 2; i++)
a[i] /= b[i];
return a;
}
for(unsigned i = 0; i < 2; i++)
return ret;
}
//IMPL: MultiplicableConcept
inline D2<T>
for(unsigned i = 0; i < 2; i++)
ret[i] = a[i] * b;
return ret;
}
//IMPL:
//IMPL: OffsetableConcept
inline D2<T>
D2<T> r;
for(unsigned i = 0; i < 2; i++)
r[i] = a[i] + b[i];
return r;
}
inline D2<T>
D2<T> r;
for(unsigned i = 0; i < 2; i++)
r[i] = a[i] - b[i];
return r;
}
inline D2<T>
for(unsigned i = 0; i < 2; i++)
a[i] += b[i];
return a;
}
inline D2<T>
for(unsigned i = 0; i < 2; i++)
a[i] -= b[i];
return a;
}
inline T
T r;
for(unsigned i = 0; i < 2; i++)
r += a[i] * b[i];
return r;
}
/** @brief Calculates the 'dot product' or 'inner product' of \c a and \c b
* @return \f$a \bullet b = a_X b_X + a_Y b_Y\f$.
* @relates D2 */
inline T
T r;
for(unsigned i = 0; i < 2; i++) {
r += a[i] * b[i];
}
return r;
}
/** @brief Calculates the 'cross product' or 'outer product' of \c a and \c b
* @return \f$a \times b = a_Y b_X - a_X b_Y\f$.
* @relates D2 */
inline T
return a[1] * b[0] - a[0] * b[1];
}
inline D2<T>
return D2<T>(-a[Y], a[X]);
}
//TODO: concepterize the following functions
inline D2<T>
D2<T> r;
for(unsigned i = 0; i < 2; i++)
r[i] = compose(a[i],b);
return r;
}
inline D2<T>
D2<T> r;
for(unsigned i = 0; i < 2; i++)
r[i] = compose(a[i],b[i]);
return r;
}
inline D2<T>
D2<T> r;
for(unsigned i = 0; i < 2; i++)
r[i] = compose(a,b[i]);
return r;
}
inline Point
Point p;
for(unsigned i = 0; i < 2; i++)
p[i] = (*this)[i](t);
return p;
}
//TODO: we might want to have this take a Point as the parameter.
inline Point
Point p;
for(unsigned i = 0; i < 2; i++)
p[i] = (*this)[i](x, y);
return p;
}
}
}
/** A function to print out the Point. It just prints out the coords
on the given output stream */
return out_file;
}
//Some D2 Fragment implementation which requires rect:
}
}
}
// SBasis-specific declarations
}
//Piecewise<D2<SBasis> > specific declarations
Piecewise<D2<SBasis> > force_continuity(Piecewise<D2<SBasis> > const &f, double tol=0, bool closed=false);
std::vector<Piecewise<D2<SBasis> > > fuse_nearby_ends(std::vector<Piecewise<D2<SBasis> > > const &f, double tol=0);
std::vector<Geom::Piecewise<Geom::D2<Geom::SBasis> > > split_at_discontinuities (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwsbin, double tol = .0001);
//bounds specializations with order
if (xint) {
if (yint) {
}
}
return retval;
}
}
return retval;
}
std::vector<std::vector<Interval> > level_sets( D2<SBasis> const &f, std::vector<Point> pts, double tol);
} // 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 :