00001 #include <SyFi.h>
00002
00003 int main() {
00004
00005 symbol x0("x0"), x1("x1"), y0("y0"), y1("y1"), z0("z0"), z1("z1");
00006
00007 ex p0 = lst(x0,y0,z0);
00008 ex p1 = lst(x1,y1,z1);
00009
00010 Line line(p0,p1);
00011
00012 symbol t("t");
00013 ex l_repr = line.repr(t);
00014 cout <<"l.repr "<<l_repr<<endl;
00015 EQUAL_OR_DIE(l_repr, "{x==t*(x1-x0)+x0,y==y0+(-y0+y1)*t,z==z0+(z1-z0)*t,{t,0,1}}");
00016
00017 for (int i=0; i< l_repr.nops(); i++) {
00018 cout <<"l_repr.op(" <<i<<"): "<<l_repr.op(i)<<endl;
00019 }
00020
00021 ex f = x*x + y*y*y + z;
00022 ex intf = line.integrate(f);
00023 cout <<"intf "<<intf<<endl;
00024 EQUAL_OR_DIE(intf, "1/4*sqrt(y0^2+z0^2+x1^2-2*x1*x0+y1^2-2*z1*z0-2 *y0*y1+z1^2+x0^2)*y0^3+1/3*sqrt(y0^2+z0^2+x1^2-2*x1*x0+y1^2-2*z1*z0-2*y0*y1+z1^2 +x0^2)*x1^2+1/4*sqrt(y0^2+z0^2+x1^2-2*x1*x0+y1^2-2*z1*z0-2*y0*y1+z1^2+x0^2)*y0*y 1^2+1/2*sqrt(y0^2+z0^2+x1^2-2*x1*x0+y1^2-2*z1*z0-2*y0*y1+z1^2+x0^2)*z0+1/4*sqrt( y0^2+z0^2+x1^2-2*x1*x0+y1^2-2*z1*z0-2*y0*y1+z1^2+x0^2)*y1^3+1/4*sqrt(y0^2+z0^2+x 1^2-2*x1*x0+y1^2-2*z1*z0-2*y0*y1+z1^2+x0^2)*y0^2*y1+1/3*sqrt(y0^2+z0^2+x1^2-2*x1 *x0+y1^2-2*z1*z0-2*y0*y1+z1^2+x0^2)*x1*x0+1/3*sqrt(y0^2+z0^2+x1^2-2*x1*x0+y1^2-2 *z1*z0-2*y0*y1+z1^2+x0^2)*x0^2+1/2*sqrt(y0^2+z0^2+x1^2-2*x1*x0+y1^2-2*z1*z0-2*y0 *y1+z1^2+x0^2)*z1");
00025
00026
00027 return 0;
00028 }
00029