Polygon.cpp File Reference

#include <Polygon.h>

Go to the source code of this file.

Functions

lst bezier_ordinates (Tetrahedron &tetrahedra, int d)
lst bezier_ordinates (Triangle &triangle, int d)
ex barycenter_triangle (ex p0, ex p1, ex p2)
ex barycenter_tetrahedron (ex p0, ex p1, ex p2, ex p3)


Function Documentation

ex barycenter_tetrahedron ex  p0,
ex  p1,
ex  p2,
ex  p3
 

Definition at line 714 of file Polygon.cpp.

References x, y, and z.

00714                                                       {
00715  symbol b0("b0"), b1("b1"), b2("b2"), b3("b3");
00716 
00717  // 3D 
00718  ex eq1 = x == b0*p0.op(0) + b1*p1.op(0) + b2*p2.op(0) + b3*p3.op(0); 
00719  ex eq2 = y == b0*p0.op(1) + b1*p1.op(1) + b2*p2.op(1) + b3*p3.op(1); 
00720  ex eq3 = z == b0*p0.op(2) + b1*p1.op(2) + b2*p2.op(2) + b3*p3.op(2); 
00721  ex eq4 = 1 == b0 + b1 + b2 +b3; 
00722 
00723  ex sol = lsolve(lst(eq1, eq2, eq3, eq4), lst(b0, b1, b2, b3)); 
00724 
00725  return sol; 
00726 
00727 }

ex barycenter_triangle ex  p0,
ex  p1,
ex  p2
 

Definition at line 702 of file Polygon.cpp.

References x, and y.

00702                                             {
00703  // 2D
00704  symbol b0("b0"), b1("b1"), b2("b2");
00705  ex eq1 = x == b0*p0.op(0) + b1*p1.op(0) + b2*p2.op(0); 
00706  ex eq2 = y == b0*p0.op(1) + b1*p1.op(1) + b2*p2.op(1); 
00707  ex eq3 = 1 == b0 + b1 + b2; 
00708 
00709  ex sol = lsolve(lst(eq1, eq2, eq3), lst(b0, b1, b2)); 
00710 
00711  return sol; 
00712 }

lst bezier_ordinates Triangle triangle,
int  d
 

Definition at line 672 of file Polygon.cpp.

00672                                                 {
00673 
00674   //FIXME: ugly conversion to matrix 
00675 
00676   lst ret; 
00677   ex V1 = triangle.vertex(0); 
00678   ex V2 = triangle.vertex(1); 
00679   ex V3 = triangle.vertex(2); 
00680 
00681   lst V1l = ex_to<lst>(V1); 
00682   lst V2l = ex_to<lst>(V2); 
00683   lst V3l = ex_to<lst>(V3); 
00684 
00685   ex V1m  = lst_to_matrix2(V1l); 
00686   ex V2m  = lst_to_matrix2(V2l); 
00687   ex V3m  = lst_to_matrix2(V3l); 
00688 
00689   int k; 
00690   for (int i=0; i<= d; i++) {
00691     for (int j=0; j<= d-i; j++) {
00692       k= d - i - j; 
00693       ex sum = (i*V1m + j*V2m + k*V3m)/d;  
00694       ret.append(matrix_to_lst2(sum.evalm())); 
00695     }
00696   }
00697   // FIXME how should these be sorted ?????  
00698   // ret = ret.sort(); 
00699   return ret; 
00700 }

lst bezier_ordinates Tetrahedron tetrahedra,
int  d
 

Definition at line 632 of file Polygon.cpp.

Referenced by LagrangeFE::compute_basis_functions(), and main().

00632                                                      {
00633 
00634   //FIXME: ugly conversion to matrix 
00635 
00636   lst ret; 
00637   ex V1 = tetrahedra.vertex(0); 
00638   ex V2 = tetrahedra.vertex(1); 
00639   ex V3 = tetrahedra.vertex(2); 
00640   ex V4 = tetrahedra.vertex(3); 
00641 
00642   lst V1l = ex_to<lst>(V1); 
00643   lst V2l = ex_to<lst>(V2); 
00644   lst V3l = ex_to<lst>(V3); 
00645   lst V4l = ex_to<lst>(V4); 
00646 
00647 
00648   ex V1m  = lst_to_matrix2(V1l); 
00649   ex V2m  = lst_to_matrix2(V2l); 
00650   ex V3m  = lst_to_matrix2(V3l); 
00651   ex V4m  = lst_to_matrix2(V4l); 
00652 
00653   int l; 
00654   for (int i=0; i<= d; i++) {
00655     for (int j=0; j<= d; j++) {
00656       for (int k=0; k<= d; k++) {
00657         if ( d - i - j -k  >= 0 ) { 
00658           l= d - i - j -k; 
00659           ex sum = (i*V1m + j*V2m + k*V3m + l*V4m)/d;  
00660           ret.append(matrix_to_lst2(sum.evalm())); 
00661         }
00662       }
00663     }
00664   }
00665   // FIXME how should these be sorted ?????  
00666   // ret = ret.sort(); 
00667   return ret; 
00668 }


Generated on Tue Nov 22 11:10:23 2005 for SyFi by  doxygen 1.4.4