00001 #include <SyFi.h>
00002
00003 using namespace GiNaC;
00004
00005 int main() {
00006 Triangle t(lst(0,0), lst(1,0), lst(0,1));
00007 int order = 2;
00008 ex polynom;
00009 lst variables;
00010
00011 ex polynom_space = pol(order, 2, "a");
00012
00013
00014
00015
00016
00017
00018
00019 polynom = polynom_space.op(0);
00020 variables = ex_to<lst>(polynom_space.op(1));
00021
00022
00023 ex Nj;
00024
00025 lst points = bezier_ordinates(t,order);
00026
00027
00028
00029
00030
00031 for (int j=1; j <= points.nops(); j++) {
00032 lst equations;
00033 int i=0;
00034 for (int i=1; i<= points.nops() ; i++ ) {
00035
00036 ex point = points.op(i-1);
00037
00038 ex eq = polynom == dirac(i,j);
00039
00040
00041 equations.append(eq.subs(lst(x == point.op(0) , y == point.op(1))));
00042 }
00043
00044
00045
00046
00047
00048 ex subs = lsolve(equations, variables);
00049
00050 Nj = polynom.subs(subs);
00051 cout <<"Nj "<<Nj<<endl;
00052 }
00053
00054 }
00055
00056