~valavanisalex/ubuntu/oneiric/inkscape/inkscape_0.48.1-2ubuntu4

« back to all changes in this revision

Viewing changes to src/2geom/sbasis-poly.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Kees Cook, Kees Cook, Ted Gould
  • Date: 2008-02-10 14:20:16 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20080210142016-vcnb2zqyhszu0xvb
Tags: 0.46~pre1-0ubuntu1
[ Kees Cook ]
* debian/control:
  - add libgtkspell-dev build-dep to gain GtkSpell features (LP: #183547).
  - update Standards version (no changes needed).
  - add Vcs and Homepage fields.
  - switch to new python-lxml dep.
* debian/{control,rules}: switch from dpatch to quilt for more sanity.
* debian/patches/20_fix_glib_and_gxx43_ftbfs.patch:
  - merged against upstream fixes.
  - added additional fixes for newly written code.
* debian/rules: enable parallel building.

[ Ted Gould ]
* Updating POTFILES.in to make it so things build correctly.
* debian/control:
  - add ImageMagick++ and libboost-dev to build-deps

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "sbasis-poly.h"
 
2
 
 
3
namespace Geom{
 
4
 
 
5
SBasis poly_to_sbasis(Poly const & p) {
 
6
    SBasis x = Linear(0, 1);
 
7
    SBasis r;
 
8
    
 
9
    for(int i = p.size()-1; i >= 0; i--) {
 
10
        r = SBasis(Linear(p[i], p[i])) + multiply(x, r);
 
11
    }
 
12
    r.normalize();
 
13
    return r;
 
14
        
 
15
}
 
16
 
 
17
Poly sbasis_to_poly(SBasis const & sb) {
 
18
    if(sb.isZero())
 
19
        return Poly();
 
20
    Poly S; // (1-x)x = -1*x^2 + 1*x + 0
 
21
    Poly A, B;
 
22
    B.push_back(0);
 
23
    B.push_back(1);
 
24
    A.push_back(1);
 
25
    A.push_back(-1);
 
26
    S = A*B;
 
27
    Poly r;
 
28
    
 
29
    for(int i = sb.size()-1; i >= 0; i--) {
 
30
        r = S*r + sb[i][0]*A + sb[i][1]*B;
 
31
    }
 
32
    r.normalize();
 
33
    return r;
 
34
}
 
35
 
 
36
};
 
37
 
 
38
/*
 
39
  Local Variables:
 
40
  mode:c++
 
41
  c-file-style:"stroustrup"
 
42
  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
 
43
  indent-tabs-mode:nil
 
44
  fill-column:99
 
45
  End:
 
46
*/
 
47
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :