Tetrahedron Class Reference

#include <Polygon.h>

Inheritance diagram for Tetrahedron:

Polygon ReferenceTetrahedron List of all members.

Public Member Functions

 Tetrahedron (string subscript)
 Tetrahedron (ex x0, ex x1, ex x1, ex x2, string subscript="")
 ~Tetrahedron ()
virtual int no_vertices ()
virtual ex vertex (int i)
virtual Line line (int i)
virtual Triangle triangle (int i)
virtual ex repr (Repr_format format=SUBS_PERFORMED)
virtual string str ()
virtual ex integrate (ex f, Repr_format format=SUBS_PERFORMED)

Detailed Description

Definition at line 115 of file Polygon.h.


Constructor & Destructor Documentation

Tetrahedron::Tetrahedron string  subscript  )  [inline]
 

Definition at line 117 of file Polygon.h.

00117 {}

Tetrahedron::Tetrahedron ex  x0,
ex  x1,
ex  x1,
ex  x2,
string  subscript = ""
 

Definition at line 466 of file Polygon.cpp.

References Polygon::p, and Polygon::subscript.

00466                                                                        { 
00467   subscript = subscript_; 
00468   p.insert(p.end(), x0); 
00469   p.insert(p.end(), x1); 
00470   p.insert(p.end(), x2); 
00471   p.insert(p.end(), x3); 
00472 
00473 }

Tetrahedron::~Tetrahedron  )  [inline]
 

Definition at line 119 of file Polygon.h.

00119 {}


Member Function Documentation

ex Tetrahedron::integrate ex  f,
Repr_format  format = SUBS_PERFORMED
[virtual]
 

Reimplemented from Polygon.

Reimplemented in ReferenceTetrahedron.

Definition at line 537 of file Polygon.cpp.

References repr().

Referenced by main().

00537                                                       {
00538   ex t_repr = repr(); 
00539 
00540   //perform substitution
00541   lst sub = lst(t_repr.op(0), t_repr.op(1), t_repr.op(2));  
00542   ex intf = func.subs(sub); 
00543 
00544   // compute D 
00545   ex D; 
00546   ex r = t_repr.op(3).op(0); 
00547   ex s = t_repr.op(4).op(0); 
00548   ex t = t_repr.op(5).op(0); 
00549   ex a = t_repr.op(0).rhs().coeff(r,1); 
00550   ex b = t_repr.op(0).rhs().coeff(s,1); 
00551   ex c = t_repr.op(0).rhs().coeff(t,1); 
00552   ex d = t_repr.op(1).rhs().coeff(r,1); 
00553   ex e = t_repr.op(1).rhs().coeff(s,1); 
00554   ex f = t_repr.op(1).rhs().coeff(t,1); 
00555   ex g = t_repr.op(2).rhs().coeff(r,1); 
00556   ex h = t_repr.op(2).rhs().coeff(s,1); 
00557   ex k = t_repr.op(2).rhs().coeff(t,1); 
00558 
00559   D = a*(e*k-f*h) - b*(d*k-f*g) + c*(d*h - g*e); 
00560 
00561   intf = intf*D; 
00562 
00563   intf = integral(t_repr.op(5).op(0), t_repr.op(5).op(1), t_repr.op(5).op(2), intf);  
00564   intf = eval_integ(intf); 
00565 
00566   intf = integral(t_repr.op(4).op(0), t_repr.op(4).op(1), t_repr.op(4).op(2), intf);  
00567   intf = eval_integ(intf); 
00568 
00569   intf = integral(t_repr.op(3).op(0), t_repr.op(3).op(1), t_repr.op(3).op(2), intf);  
00570   intf = eval_integ(intf); 
00571 
00572   return intf; 
00573 }

Line Tetrahedron::line int  i  )  [virtual]
 

Reimplemented in ReferenceTetrahedron.

Definition at line 481 of file Polygon.cpp.

References istr(), Polygon::p, and Polygon::subscript.

Referenced by ReferenceTetrahedron::line(), and repr().

00481                              {
00482   int i0, i1; 
00483   if ( i == 1 ) {
00484     i0 = 0; i1 = 1;  
00485   } else if ( i == 2 ) { 
00486     i0 = 0; i1 = 2;  
00487   } else if ( i == 3 )  { 
00488     i0 = 0; i1 = 3;  
00489   } else if ( i == 4 )  { 
00490     i0 = 1; i1 = 2;  
00491   } else if ( i == 5 )  { 
00492     i0 = 1; i1 = 3;  
00493   } else if ( i == 6 )  { 
00494     i0 = 2; i1 = 3;  
00495   }
00496   Line l = Line(p[i0], p[i1], istr(subscript,i)); 
00497   return l; 
00498 }

int Tetrahedron::no_vertices  )  [virtual]
 

Reimplemented from Polygon.

Reimplemented in ReferenceTetrahedron.

Definition at line 475 of file Polygon.cpp.

00475 {return 4; }

ex Tetrahedron::repr Repr_format  format = SUBS_PERFORMED  )  [virtual]
 

Reimplemented in ReferenceTetrahedron.

Definition at line 513 of file Polygon.cpp.

References line(), Line::repr(), x, y, and z.

Referenced by integrate(), and main().

00513                                         {
00514    symbol r("r"), s("s"), t("t"); 
00515    ex l1_repr = line(1).repr(r); 
00516    ex l2_repr = line(2).repr(s); 
00517    ex l3_repr = line(3).repr(t); 
00518    lst ret; 
00519 
00520 
00521    ret = lst( 
00522        x == l1_repr.op(0).rhs().coeff(r,0)   + l1_repr.op(0).rhs().coeff(r,1)*r 
00523          +  l2_repr.op(0).rhs().coeff(s,1)*s + l3_repr.op(0).rhs().coeff(t,1)*t,  
00524        y == l1_repr.op(1).rhs().coeff(r,0)   + l1_repr.op(1).rhs().coeff(r,1)*r 
00525          +  l2_repr.op(1).rhs().coeff(s,1)*s + l3_repr.op(1).rhs().coeff(t,1)*t,  
00526        z == l1_repr.op(2).rhs().coeff(r,0)   + l1_repr.op(1).rhs().coeff(r,1)*r  
00527          +  l2_repr.op(2).rhs().coeff(s,1)*s + l3_repr.op(2).rhs().coeff(t,1)*t);   
00528 
00529 
00530    ret.append(lst(r, 0, 1)); 
00531    ret.append(lst(s, 0, 1 - r)); 
00532    ret.append(lst(t, 0, 1 - r - s)); 
00533 
00534    return ret; 
00535 }

string Tetrahedron::str  )  [virtual]
 

Reimplemented from Polygon.

Reimplemented in ReferenceTetrahedron.

Definition at line 505 of file Polygon.cpp.

00505                          {
00506    std::ostringstream s; 
00507 //   s <<"Tetrahedron("<<p[0]<<","<<p[1]<<","<<p[2]<<","<<p[3]<<")"; 
00508    s <<"Tetrahedron";
00509    return s.str(); 
00510 }

Triangle Tetrahedron::triangle int  i  )  [virtual]
 

Reimplemented in ReferenceTetrahedron.

Definition at line 500 of file Polygon.cpp.

References istr(), Polygon::p, and Polygon::subscript.

Referenced by ReferenceTetrahedron::triangle().

00500                                       {
00501   Triangle t = Triangle(p[i%4], p[(i+1)%4], p[(i+2)%4], istr(subscript,i)); 
00502   return t; 
00503 }

ex Tetrahedron::vertex int  i  )  [virtual]
 

Reimplemented from Polygon.

Reimplemented in ReferenceTetrahedron.

Definition at line 477 of file Polygon.cpp.

References Polygon::p.

Referenced by bezier_ordinates(), and ReferenceTetrahedron::vertex().

00477                              {
00478   return p[i]; 
00479 }


The documentation for this class was generated from the following files:
Generated on Tue Nov 22 11:10:23 2005 for SyFi by  doxygen 1.4.4