Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
d2.h
Go to the documentation of this file.
1/*
5 * Authors:
6 * Michael Sloan <mgsloan@gmail.com>
7 * Krzysztof KosiƄski <tweenk.pl@gmail.com>
8 *
9 * Copyright 2007-2015 Authors
10 *
11 * This library is free software; you can redistribute it and/or
12 * modify it either under the terms of the GNU Lesser General Public
13 * License version 2.1 as published by the Free Software Foundation
14 * (the "LGPL") or, at your option, under the terms of the Mozilla
15 * Public License Version 1.1 (the "MPL"). If you do not alter this
16 * notice, a recipient may use your version of this file under either
17 * the MPL or the LGPL.
18 *
19 * You should have received a copy of the LGPL along with this library
20 * in the file COPYING-LGPL-2.1; if not, output to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 * You should have received a copy of the MPL along with this library
23 * in the file COPYING-MPL-1.1
24 *
25 * The contents of this file are subject to the Mozilla Public License
26 * Version 1.1 (the "License"); you may not use this file except in
27 * compliance with the License. You may obtain a copy of the License at
28 * http://www.mozilla.org/MPL/
29 *
30 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
31 * OF ANY KIND, either express or implied. See the LGPL or the MPL for
32 * the specific language governing rights and limitations.
33 *
34 */
35
36#ifndef LIB2GEOM_SEEN_D2_H
37#define LIB2GEOM_SEEN_D2_H
38
39#include <iterator>
40#include <boost/concept/assert.hpp>
41#include <boost/iterator/transform_iterator.hpp>
42#include <2geom/point.h>
43#include <2geom/interval.h>
44#include <2geom/affine.h>
45#include <2geom/rect.h>
46#include <2geom/concepts.h>
47
48namespace Geom {
53template <typename T>
54class D2
55{
56private:
57 T f[2];
58
59public:
60 typedef T D1Value;
61 typedef T &D1Reference;
62 typedef T const &D1ConstReference;
63
64 D2() {f[X] = f[Y] = T();}
65 explicit D2(Point const &a) {
66 f[X] = T(a[X]); f[Y] = T(a[Y]);
67 }
68
69 D2(T const &a, T const &b) {
70 f[X] = a;
71 f[Y] = b;
72 }
73
74 template <typename Iter>
75 D2(Iter first, Iter last) {
76 typedef typename std::iterator_traits<Iter>::value_type V;
77 typedef typename boost::transform_iterator<GetAxis<X,V>, Iter> XIter;
78 typedef typename boost::transform_iterator<GetAxis<Y,V>, Iter> YIter;
79
80 XIter xfirst(first, GetAxis<X,V>()), xlast(last, GetAxis<X,V>());
81 f[X] = T(xfirst, xlast);
82 YIter yfirst(first, GetAxis<Y,V>()), ylast(last, GetAxis<Y,V>());
83 f[Y] = T(yfirst, ylast);
84 }
85
86 D2(std::vector<Point> const &vec) {
87 typedef Point V;
88 typedef std::vector<Point>::const_iterator Iter;
89 typedef boost::transform_iterator<GetAxis<X,V>, Iter> XIter;
90 typedef boost::transform_iterator<GetAxis<Y,V>, Iter> YIter;
91
92 XIter xfirst(vec.begin(), GetAxis<X,V>()), xlast(vec.end(), GetAxis<X,V>());
93 f[X] = T(xfirst, xlast);
94 YIter yfirst(vec.begin(), GetAxis<Y,V>()), ylast(vec.end(), GetAxis<Y,V>());
95 f[Y] = T(yfirst, ylast);
96 }
97
98 //TODO: ask MenTaLguY about operator= as seen in Point
99
100 T& operator[](unsigned i) { return f[i]; }
101 T const & operator[](unsigned i) const { return f[i]; }
102 Point point(unsigned i) const {
103 Point ret(f[X][i], f[Y][i]);
104 return ret;
105 }
106
107 //IMPL: FragmentConcept
109 bool isZero(double eps=EPSILON) const {
110 BOOST_CONCEPT_ASSERT((FragmentConcept<T>));
111 return f[X].isZero(eps) && f[Y].isZero(eps);
112 }
113 bool isConstant(double eps=EPSILON) const {
114 BOOST_CONCEPT_ASSERT((FragmentConcept<T>));
115 return f[X].isConstant(eps) && f[Y].isConstant(eps);
116 }
117 bool isFinite() const {
118 BOOST_CONCEPT_ASSERT((FragmentConcept<T>));
119 return f[X].isFinite() && f[Y].isFinite();
120 }
121 Point at0() const {
122 BOOST_CONCEPT_ASSERT((FragmentConcept<T>));
123 return Point(f[X].at0(), f[Y].at0());
124 }
125 Point at1() const {
126 BOOST_CONCEPT_ASSERT((FragmentConcept<T>));
127 return Point(f[X].at1(), f[Y].at1());
128 }
129 Point pointAt(double t) const {
130 BOOST_CONCEPT_ASSERT((FragmentConcept<T>));
131 return (*this)(t);
132 }
133 Point valueAt(double t) const {
134 // TODO: remove this alias
135 BOOST_CONCEPT_ASSERT((FragmentConcept<T>));
136 return (*this)(t);
137 }
138 std::vector<Point > valueAndDerivatives(double t, unsigned n) const {
139 BOOST_CONCEPT_ASSERT((FragmentConcept<T>));
140 std::vector<Coord> x = f[X].valueAndDerivatives(t, n),
141 y = f[Y].valueAndDerivatives(t, n); // always returns a vector of size n+1
142 std::vector<Point> res(n+1);
143 for(unsigned i = 0; i <= n; i++) {
144 res[i] = Point(x[i], y[i]);
145 }
146 return res;
147 }
149 BOOST_CONCEPT_ASSERT((FragmentConcept<T>));
150 return D2<SBasis>(f[X].toSBasis(), f[Y].toSBasis());
151 }
152
153 Point operator()(double t) const;
154 Point operator()(double x, double y) const;
155};
156template <typename T>
157inline D2<T> reverse(const D2<T> &a) {
158 BOOST_CONCEPT_ASSERT((FragmentConcept<T>));
159 return D2<T>(reverse(a[X]), reverse(a[Y]));
160}
161
162template <typename T>
163inline D2<T> portion(const D2<T> &a, Coord f, Coord t) {
164 BOOST_CONCEPT_ASSERT((FragmentConcept<T>));
165 return D2<T>(portion(a[X], f, t), portion(a[Y], f, t));
166}
167
168template <typename T>
169inline D2<T> portion(const D2<T> &a, Interval i) {
170 BOOST_CONCEPT_ASSERT((FragmentConcept<T>));
171 return D2<T>(portion(a[X], i), portion(a[Y], i));
172}
173
174//IMPL: EqualityComparableConcept
175template <typename T>
176inline bool
177operator==(D2<T> const &a, D2<T> const &b) {
178 BOOST_CONCEPT_ASSERT((EqualityComparableConcept<T>));
179 return a[0]==b[0] && a[1]==b[1];
180}
181template <typename T>
182inline bool
183operator!=(D2<T> const &a, D2<T> const &b) {
184 BOOST_CONCEPT_ASSERT((EqualityComparableConcept<T>));
185 return a[0]!=b[0] || a[1]!=b[1];
186}
187
188//IMPL: NearConcept
189template <typename T>
190inline bool
191are_near(D2<T> const &a, D2<T> const &b, double tol) {
192 BOOST_CONCEPT_ASSERT((NearConcept<T>));
193 return are_near(a[0], b[0], tol) && are_near(a[1], b[1], tol);
194}
195
196//IMPL: AddableConcept
197template <typename T>
198inline D2<T>
199operator+(D2<T> const &a, D2<T> const &b) {
200 BOOST_CONCEPT_ASSERT((AddableConcept<T>));
201
202 D2<T> r;
203 for(unsigned i = 0; i < 2; i++)
204 r[i] = a[i] + b[i];
205 return r;
206}
207template <typename T>
208inline D2<T>
209operator-(D2<T> const &a, D2<T> const &b) {
210 BOOST_CONCEPT_ASSERT((AddableConcept<T>));
211
212 D2<T> r;
213 for(unsigned i = 0; i < 2; i++)
214 r[i] = a[i] - b[i];
215 return r;
216}
217template <typename T>
218inline D2<T>
219operator+=(D2<T> &a, D2<T> const &b) {
220 BOOST_CONCEPT_ASSERT((AddableConcept<T>));
221
222 for(unsigned i = 0; i < 2; i++)
223 a[i] += b[i];
224 return a;
225}
226template <typename T>
227inline D2<T>
228operator-=(D2<T> &a, D2<T> const & b) {
229 BOOST_CONCEPT_ASSERT((AddableConcept<T>));
230
231 for(unsigned i = 0; i < 2; i++)
232 a[i] -= b[i];
233 return a;
234}
235
236//IMPL: ScalableConcept
237template <typename T>
238inline D2<T>
239operator-(D2<T> const & a) {
240 BOOST_CONCEPT_ASSERT((ScalableConcept<T>));
241 D2<T> r;
242 for(unsigned i = 0; i < 2; i++)
243 r[i] = -a[i];
244 return r;
245}
246template <typename T>
247inline D2<T>
248operator*(D2<T> const & a, Point const & b) {
249 BOOST_CONCEPT_ASSERT((ScalableConcept<T>));
250
251 D2<T> r;
252 for(unsigned i = 0; i < 2; i++)
253 r[i] = a[i] * b[i];
254 return r;
255}
256template <typename T>
257inline D2<T>
258operator/(D2<T> const & a, Point const & b) {
259 BOOST_CONCEPT_ASSERT((ScalableConcept<T>));
260 //TODO: b==0?
261 D2<T> r;
262 for(unsigned i = 0; i < 2; i++)
263 r[i] = a[i] / b[i];
264 return r;
265}
266template <typename T>
267inline D2<T>
268operator*=(D2<T> &a, Point const & b) {
269 BOOST_CONCEPT_ASSERT((ScalableConcept<T>));
270
271 for(unsigned i = 0; i < 2; i++)
272 a[i] *= b[i];
273 return a;
274}
275template <typename T>
276inline D2<T>
277operator/=(D2<T> &a, Point const & b) {
278 BOOST_CONCEPT_ASSERT((ScalableConcept<T>));
279 //TODO: b==0?
280 for(unsigned i = 0; i < 2; i++)
281 a[i] /= b[i];
282 return a;
283}
284
285template <typename T>
286inline D2<T> operator*(D2<T> const & a, double b) { return D2<T>(a[0]*b, a[1]*b); }
287template <typename T>
288inline D2<T> operator*=(D2<T> & a, double b) { a[0] *= b; a[1] *= b; return a; }
289template <typename T>
290inline D2<T> operator/(D2<T> const & a, double b) { return D2<T>(a[0]/b, a[1]/b); }
291template <typename T>
292inline D2<T> operator/=(D2<T> & a, double b) { a[0] /= b; a[1] /= b; return a; }
293
294template<typename T>
295D2<T> operator*(D2<T> const &v, Affine const &m) {
296 BOOST_CONCEPT_ASSERT((AddableConcept<T>));
297 BOOST_CONCEPT_ASSERT((ScalableConcept<T>));
298 D2<T> ret;
299 for(unsigned i = 0; i < 2; i++)
300 ret[i] = v[X] * m[i] + v[Y] * m[i + 2] + m[i + 4];
301 return ret;
302}
303
304//IMPL: MultiplicableConcept
305template <typename T>
306inline D2<T>
307operator*(D2<T> const & a, T const & b) {
308 BOOST_CONCEPT_ASSERT((MultiplicableConcept<T>));
309 D2<T> ret;
310 for(unsigned i = 0; i < 2; i++)
311 ret[i] = a[i] * b;
312 return ret;
313}
314
315//IMPL:
316
317//IMPL: OffsetableConcept
318template <typename T>
319inline D2<T>
320operator+(D2<T> const & a, Point b) {
321 BOOST_CONCEPT_ASSERT((OffsetableConcept<T>));
322 D2<T> r;
323 for(unsigned i = 0; i < 2; i++)
324 r[i] = a[i] + b[i];
325 return r;
326}
327template <typename T>
328inline D2<T>
329operator-(D2<T> const & a, Point b) {
330 BOOST_CONCEPT_ASSERT((OffsetableConcept<T>));
331 D2<T> r;
332 for(unsigned i = 0; i < 2; i++)
333 r[i] = a[i] - b[i];
334 return r;
335}
336template <typename T>
337inline D2<T>
339 BOOST_CONCEPT_ASSERT((OffsetableConcept<T>));
340 for(unsigned i = 0; i < 2; i++)
341 a[i] += b[i];
342 return a;
343}
344template <typename T>
345inline D2<T>
347 BOOST_CONCEPT_ASSERT((OffsetableConcept<T>));
348 for(unsigned i = 0; i < 2; i++)
349 a[i] -= b[i];
350 return a;
351}
352
353template <typename T>
354inline T
355dot(D2<T> const & a, D2<T> const & b) {
356 BOOST_CONCEPT_ASSERT((AddableConcept<T>));
357 BOOST_CONCEPT_ASSERT((MultiplicableConcept<T>));
358
359 T r;
360 for(unsigned i = 0; i < 2; i++)
361 r += a[i] * b[i];
362 return r;
363}
364
368template <typename T>
369inline T
370dot(D2<T> const & a, Point const & b) {
371 BOOST_CONCEPT_ASSERT((AddableConcept<T>));
372 BOOST_CONCEPT_ASSERT((ScalableConcept<T>));
373
374 T r;
375 for(unsigned i = 0; i < 2; i++) {
376 r += a[i] * b[i];
377 }
378 return r;
379}
380
384template <typename T>
385inline T
386cross(D2<T> const & a, D2<T> const & b) {
387 BOOST_CONCEPT_ASSERT((ScalableConcept<T>));
388 BOOST_CONCEPT_ASSERT((MultiplicableConcept<T>));
389
390 return a[1] * b[0] - a[0] * b[1];
391}
392
393
394//equivalent to cw/ccw, for use in situations where rotation direction doesn't matter.
395template <typename T>
396inline D2<T>
397rot90(D2<T> const & a) {
398 BOOST_CONCEPT_ASSERT((ScalableConcept<T>));
399 return D2<T>(-a[Y], a[X]);
400}
401
402//TODO: concepterize the following functions
403template <typename T>
404inline D2<T>
405compose(D2<T> const & a, T const & b) {
406 D2<T> r;
407 for(unsigned i = 0; i < 2; i++)
408 r[i] = compose(a[i],b);
409 return r;
410}
411
412template <typename T>
413inline D2<T>
414compose_each(D2<T> const & a, D2<T> const & b) {
415 D2<T> r;
416 for(unsigned i = 0; i < 2; i++)
417 r[i] = compose(a[i],b[i]);
418 return r;
419}
420
421template <typename T>
422inline D2<T>
423compose_each(T const & a, D2<T> const & b) {
424 D2<T> r;
425 for(unsigned i = 0; i < 2; i++)
426 r[i] = compose(a,b[i]);
427 return r;
428}
429
430
431template<typename T>
432inline Point
433D2<T>::operator()(double t) const {
434 Point p;
435 for(unsigned i = 0; i < 2; i++)
436 p[i] = (*this)[i](t);
437 return p;
438}
439
440//TODO: we might want to have this take a Point as the parameter.
441template<typename T>
442inline Point
443D2<T>::operator()(double x, double y) const {
444 Point p;
445 for(unsigned i = 0; i < 2; i++)
446 p[i] = (*this)[i](x, y);
447 return p;
448}
449
450
451template<typename T>
453 return D2<T>(derivative(a[X]), derivative(a[Y]));
454}
455template<typename T>
456D2<T> integral(D2<T> const & a) {
457 return D2<T>(integral(a[X]), integral(a[Y]));
458}
459
462template <typename T>
463inline std::ostream &operator<< (std::ostream &out_file, const Geom::D2<T> &in_d2) {
464 out_file << "X: " << in_d2[X] << " Y: " << in_d2[Y];
465 return out_file;
466}
467
468//Some D2 Fragment implementation which requires rect:
469template <typename T>
471 BOOST_CONCEPT_ASSERT((FragmentConcept<T>));
472 return OptRect(bounds_fast(a[X]), bounds_fast(a[Y]));
473}
474template <typename T>
476 BOOST_CONCEPT_ASSERT((FragmentConcept<T>));
477 return OptRect(bounds_exact(a[X]), bounds_exact(a[Y]));
478}
479template <typename T>
481 BOOST_CONCEPT_ASSERT((FragmentConcept<T>));
482 return OptRect(bounds_local(a[X], t), bounds_local(a[Y], t));
483}
484
485
486
487// SBasis-specific declarations
488
489inline D2<SBasis> compose(D2<SBasis> const & a, SBasis const & b) {
490 return D2<SBasis>(compose(a[X], b), compose(a[Y], b));
491}
492
493SBasis L2(D2<SBasis> const & a, unsigned k);
494double L2(D2<double> const & a);
495
496D2<SBasis> multiply(Linear const & a, D2<SBasis> const & b);
497inline D2<SBasis> operator*(Linear const & a, D2<SBasis> const & b) { return multiply(a, b); }
498D2<SBasis> multiply(SBasis const & a, D2<SBasis> const & b);
499inline D2<SBasis> operator*(SBasis const & a, D2<SBasis> const & b) { return multiply(a, b); }
500D2<SBasis> truncate(D2<SBasis> const & a, unsigned terms);
501
502unsigned sbasis_size(D2<SBasis> const & a);
503double tail_error(D2<SBasis> const & a, unsigned tail);
504
505//Piecewise<D2<SBasis> > specific declarations
506
507Piecewise<D2<SBasis> > sectionize(D2<Piecewise<SBasis> > const &a);
508D2<Piecewise<SBasis> > make_cuts_independent(Piecewise<D2<SBasis> > const &a);
509Piecewise<D2<SBasis> > rot90(Piecewise<D2<SBasis> > const &a);
513
515
516Piecewise<D2<SBasis> > force_continuity(Piecewise<D2<SBasis> > const &f, double tol=0, bool closed=false);
517
518std::vector<Piecewise<D2<SBasis> > > fuse_nearby_ends(std::vector<Piecewise<D2<SBasis> > > const &f, double tol=0);
519
520std::vector<Geom::Piecewise<Geom::D2<Geom::SBasis> > > split_at_discontinuities (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwsbin, double tol = .0001);
521
522Point unitTangentAt(D2<SBasis> const & a, Coord t, unsigned n = 3);
523
524//bounds specializations with order
525inline OptRect bounds_fast(D2<SBasis> const & s, unsigned order=0) {
526 OptRect retval;
527 OptInterval xint = bounds_fast(s[X], order);
528 if (xint) {
529 OptInterval yint = bounds_fast(s[Y], order);
530 if (yint) {
531 retval = Rect(*xint, *yint);
532 }
533 }
534 return retval;
535}
536inline OptRect bounds_local(D2<SBasis> const & s, OptInterval i, unsigned order=0) {
537 OptRect retval;
538 OptInterval xint = bounds_local(s[X], i, order);
539 OptInterval yint = bounds_local(s[Y], i, order);
540 if (xint && yint) {
541 retval = Rect(*xint, *yint);
542 }
543 return retval;
544}
545
546std::vector<Interval> level_set( D2<SBasis> const &f, Rect region);
547std::vector<Interval> level_set( D2<SBasis> const &f, Point p, double tol);
548std::vector<std::vector<Interval> > level_sets( D2<SBasis> const &f, std::vector<Rect> regions);
549std::vector<std::vector<Interval> > level_sets( D2<SBasis> const &f, std::vector<Point> pts, double tol);
550
551
552} // end namespace Geom
553
554#endif
555/*
556 Local Variables:
557 mode:c++
558 c-file-style:"stroustrup"
559 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
560 indent-tabs-mode:nil
561 fill-column:99
562 End:
563*/
564// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
Cartesian point / 2D vector and related operations.
pair< double, double > Point
Definition parser.cpp:7
3x3 affine transformation matrix.
3x3 matrix representing an affine transformation.
Definition affine.h:70
Adaptor that creates 2D functions from 1D ones.
Definition d2.h:55
Point operator()(double t) const
Definition d2.h:433
T & operator[](unsigned i)
Definition d2.h:100
Point output_type
Definition d2.h:108
bool isFinite() const
Definition d2.h:117
D2< SBasis > toSBasis() const
Definition d2.h:148
T const & D1ConstReference
Definition d2.h:62
T & D1Reference
Definition d2.h:61
Point operator()(double x, double y) const
Definition d2.h:443
bool isZero(double eps=EPSILON) const
Definition d2.h:109
Point point(unsigned i) const
Definition d2.h:102
Point at1() const
Definition d2.h:125
T const & operator[](unsigned i) const
Definition d2.h:101
D2(T const &a, T const &b)
Definition d2.h:69
T cross(D2< T > const &a, D2< T > const &b)
Calculates the 'cross product' or 'outer product' of a and b.
Definition d2.h:386
Point at0() const
Definition d2.h:121
D2(Iter first, Iter last)
Definition d2.h:75
Point pointAt(double t) const
Definition d2.h:129
bool isConstant(double eps=EPSILON) const
Definition d2.h:113
T D1Value
Definition d2.h:60
D2(Point const &a)
Definition d2.h:65
Point valueAt(double t) const
Definition d2.h:133
D2(std::vector< Point > const &vec)
Definition d2.h:86
T f[2]
Definition d2.h:57
std::vector< Point > valueAndDerivatives(double t, unsigned n) const
Definition d2.h:138
T dot(D2< T > const &a, Point const &b)
Calculates the 'dot product' or 'inner product' of a and b.
Definition d2.h:370
D2()
Definition d2.h:64
Range of real numbers that is never empty.
Definition interval.h:59
Function that interpolates linearly between two values.
Definition linear.h:55
Range of real numbers that can be empty.
Definition interval.h:199
Axis-aligned rectangle that can be empty.
Definition rect.h:203
Function defined as discrete pieces.
Definition piecewise.h:71
Two-dimensional point that doubles as a vector.
Definition point.h:66
Axis aligned, non-empty rectangle.
Definition rect.h:92
Polynomial in symmetric power basis.
Definition sbasis.h:70
Template concepts used by 2Geom.
const unsigned order
double Coord
Floating point type used to store coordinates.
Definition coord.h:76
constexpr Coord EPSILON
Default "acceptably small" value.
Definition coord.h:84
@ Y
Definition coord.h:48
@ X
Definition coord.h:48
Simple closed interval class.
Various utility functions.
Definition affine.h:22
std::vector< std::vector< Interval > > level_sets(D2< SBasis > const &f, std::vector< Rect > regions)
D2< Piecewise< SBasis > > make_cuts_independent(Piecewise< D2< SBasis > > const &a)
Definition d2-sbasis.cpp:75
OptInterval bounds_exact(Bezier const &b)
Definition bezier.cpp:310
Bezier reverse(const Bezier &a)
Definition bezier.h:342
OptInterval bounds_local(Bezier const &b, OptInterval const &i)
Definition bezier.cpp:320
Bezier multiply(Bezier const &f, Bezier const &g)
Definition bezier.h:337
D2< T > operator+=(D2< T > &a, D2< T > const &b)
Definition d2.h:219
std::vector< Geom::Piecewise< Geom::D2< Geom::SBasis > > > split_at_discontinuities(Geom::Piecewise< Geom::D2< Geom::SBasis > > const &pwsbin, double tol=.0001)
D2< T > operator/(D2< T > const &a, Point const &b)
Definition d2.h:258
unsigned sbasis_size(D2< SBasis > const &a)
Definition d2-sbasis.cpp:56
Piecewise< D2< SBasis > > sectionize(D2< Piecewise< SBasis > > const &a)
Definition d2-sbasis.cpp:65
D2< T > operator-(D2< T > const &a, D2< T > const &b)
Definition d2.h:209
std::vector< Piecewise< D2< SBasis > > > fuse_nearby_ends(std::vector< Piecewise< D2< SBasis > > > const &f, double tol=0)
D2< T > operator*=(D2< T > &a, Point const &b)
Definition d2.h:268
Bezier operator*(Bezier const &f, Bezier const &g)
Definition bezier.cpp:221
D2< T > operator-=(D2< T > &a, D2< T > const &b)
Definition d2.h:228
double tail_error(D2< SBasis > const &a, unsigned tail)
Definition d2-sbasis.cpp:61
D2< T > compose(D2< T > const &a, T const &b)
Definition d2.h:405
Bezier portion(const Bezier &a, double from, double to)
Definition bezier.cpp:250
Bezier integral(Bezier const &a)
Definition bezier.cpp:294
Bezier derivative(Bezier const &a)
Definition bezier.cpp:282
D2< T > operator+(D2< T > const &a, D2< T > const &b)
Definition d2.h:199
D2< T > compose_each(D2< T > const &a, D2< T > const &b)
Definition d2.h:414
Piecewise< SBasis > cross(Piecewise< D2< SBasis > > const &a, Piecewise< D2< SBasis > > const &b)
SBasis L2(D2< SBasis > const &a, unsigned k)
Definition d2-sbasis.cpp:42
Point unitTangentAt(D2< SBasis > const &a, Coord t, unsigned n=3)
D2< SBasis > truncate(D2< SBasis > const &a, unsigned terms)
Definition d2-sbasis.cpp:52
T dot(D2< T > const &a, D2< T > const &b)
Definition d2.h:355
OptInterval bounds_fast(Bezier const &b)
Definition bezier.cpp:305
Piecewise< D2< SBasis > > force_continuity(Piecewise< D2< SBasis > > const &f, double tol=0, bool closed=false)
bool are_near(Affine const &a1, Affine const &a2, Coord eps=EPSILON)
bool operator==(D2< T > const &a, D2< T > const &b)
Definition d2.h:177
bool operator!=(D2< T > const &a, D2< T > const &b)
Definition d2.h:183
D2< T > rot90(D2< T > const &a)
Definition d2.h:397
std::vector< Interval > level_set(D2< SBasis > const &f, Rect region)
D2< T > operator/=(D2< T > &a, Point const &b)
Definition d2.h:277
Axis-aligned rectangle.
Axis extraction functor.
Definition coord.h:66