#include <Polygon.h>
Inheritance diagram for Rectangle:
Public Member Functions | |
Rectangle (GiNaC::ex p0, GiNaC::ex p1, string subscript="") | |
Rectangle () | |
virtual | ~Rectangle () |
virtual int | no_vertices () |
virtual GiNaC::ex | vertex (int i) |
virtual Line | line (int i) |
virtual GiNaC::ex | repr (Repr_format format=SUBS_PERFORMED) |
virtual string | str () |
virtual GiNaC::ex | integrate (GiNaC::ex f) |
Definition at line 113 of file Polygon.h.
|
Definition at line 512 of file Polygon.cpp. References Polygon::p, and Polygon::subscript. 00512 { 00513 subscript = subscript_; 00514 00515 GiNaC::ex x0; 00516 GiNaC::ex x1; 00517 GiNaC::ex x2; 00518 GiNaC::ex x3; 00519 00520 if (p0.nops() == 2 && p1.nops() == 2) { 00521 00522 x0 = GiNaC::lst(p0.op(0), p0.op(1)); 00523 x1 = GiNaC::lst(p1.op(0), p0.op(1)); 00524 x2 = GiNaC::lst(p1.op(0), p1.op(1)); 00525 x3 = GiNaC::lst(p0.op(0), p1.op(1)); 00526 00527 } 00528 else if (p0.nops() == 3 && p1.nops() == 3) { 00529 if ( p0.op(0) == p1.op(0) ) { 00530 00531 x0 = GiNaC::lst(p0.op(0), p0.op(1), p0.op(2)); 00532 x1 = GiNaC::lst(p0.op(0), p1.op(1), p0.op(2)); 00533 x2 = GiNaC::lst(p0.op(0), p1.op(1), p1.op(2)); 00534 x3 = GiNaC::lst(p0.op(0), p0.op(1), p1.op(2)); 00535 00536 } else if ( p0.op(1) == p1.op(1) ) { 00537 00538 x0 = GiNaC::lst(p0.op(0), p0.op(1), p0.op(2)); 00539 x1 = GiNaC::lst(p1.op(0), p0.op(1), p0.op(2)); 00540 x2 = GiNaC::lst(p1.op(0), p0.op(1), p1.op(2)); 00541 x3 = GiNaC::lst(p0.op(0), p0.op(1), p1.op(2)); 00542 00543 } else if ( p0.op(2) == p1.op(2) ) { 00544 00545 x0 = GiNaC::lst(p0.op(0), p0.op(1), p0.op(2)); 00546 x1 = GiNaC::lst(p1.op(0), p0.op(1), p0.op(2)); 00547 x2 = GiNaC::lst(p1.op(0), p1.op(1), p0.op(2)); 00548 x3 = GiNaC::lst(p0.op(0), p1.op(1), p0.op(2)); 00549 00550 } 00551 } else { 00552 throw(std::invalid_argument("The points p0 and p1 must be of dimention either 2 or 3.")); 00553 } 00554 00555 p.insert(p.end(), x0); 00556 p.insert(p.end(), x1); 00557 p.insert(p.end(), x2); 00558 p.insert(p.end(), x3); 00559 00560 }
|
|
Definition at line 116 of file Polygon.h.
|
|
Definition at line 117 of file Polygon.h.
|
|
Reimplemented in ReferenceRectangle. Definition at line 598 of file Polygon.cpp. References Polygon::p, and repr(). Referenced by ReferenceRectangle::integrate(), and main(). 00598 { 00599 00600 int counter; 00601 GiNaC::ex s_repr = repr(); 00602 00603 GiNaC::lst sub; 00604 // perform substitution 00605 if ( p[0].nops() == 3) { 00606 sub = GiNaC::lst(s_repr.op(0), s_repr.op(1), s_repr.op(2)); 00607 counter = 3; 00608 } else if ( p[0].nops() == 2) { 00609 sub = GiNaC::lst(s_repr.op(0), s_repr.op(1)); 00610 counter = 2; 00611 } 00612 00613 GiNaC::ex D; 00614 if (p[0].nops() == 2) { 00615 D = ( p[2].op(0) - p[0].op(0)) 00616 *( p[2].op(1) - p[0].op(1)); 00617 } else if (p[0].nops() == 3) { 00618 00619 if ( p[2].op(0) == p[0].op(0) ) { 00620 D = ( p[2].op(1) - p[0].op(1)) 00621 *( p[2].op(2) - p[0].op(2)); 00622 } 00623 else if ( p[2].op(1) == p[0].op(1) ) { 00624 D = ( p[2].op(0) - p[0].op(0)) 00625 *( p[2].op(2) - p[0].op(2)); 00626 } 00627 else if ( p[2].op(2) == p[0].op(2) ) { 00628 D = ( p[2].op(0) - p[0].op(0)) 00629 *( p[2].op(1) - p[0].op(1)); 00630 } 00631 } 00632 00633 GiNaC::ex intf = func.subs(sub); 00634 00635 intf = intf*D; 00636 00637 intf = GiNaC::integral(s_repr.op(counter).op(0), s_repr.op(counter).op(1), s_repr.op(counter).op(2), intf); 00638 intf = eval_integ(intf); 00639 00640 counter++; 00641 intf = GiNaC::integral(s_repr.op(counter).op(0), s_repr.op(counter).op(1), s_repr.op(counter).op(2), intf); 00642 intf = eval_integ(intf); 00643 00644 counter++; 00645 if ( counter < s_repr.nops() ) { 00646 intf = GiNaC::integral(s_repr.op(counter).op(0), s_repr.op(counter).op(1), s_repr.op(counter).op(2), intf); 00647 intf = eval_integ(intf); 00648 } 00649 00650 return intf; 00651 00652 00653 }
|
|
Reimplemented in ReferenceRectangle. Definition at line 568 of file Polygon.cpp. References istr(), Polygon::p, and Polygon::subscript. Referenced by ReferenceRectangle::line(). 00568 { 00569 if ( i == 1) return Line(p[0],p[1], istr(subscript,i)); 00570 else if ( i == 2) return Line(p[1],p[2], istr(subscript,i)); 00571 else if ( i == 3) return Line(p[2],p[3], istr(subscript,i)); 00572 else if ( i == 4) return Line(p[3],p[0], istr(subscript,i)); 00573 }
|
|
Reimplemented from Polygon. Reimplemented in ReferenceRectangle. Definition at line 562 of file Polygon.cpp.
|
|
Reimplemented in ReferenceRectangle. Definition at line 575 of file Polygon.cpp. References Polygon::p, x, y, and z. Referenced by integrate(), main(), and ReferenceRectangle::repr(). 00575 { 00576 GiNaC::lst ret; 00577 GiNaC::symbol r("r"), s("s"), t("t"); 00578 if ( p[0].nops() == 2) { 00579 ret.append( x == p[0].op(0) + r*( p[2].op(0) - p[0].op(0))); 00580 ret.append( y == p[0].op(1) + s*( p[2].op(1) - p[0].op(1))); 00581 ret.append( GiNaC::lst(r,0,1)); 00582 ret.append( GiNaC::lst(s,0,1)); 00583 } else if ( p[0].nops() == 3) { 00584 ret.append( x == p[0].op(0) + r*( p[2].op(0) - p[0].op(0))); 00585 ret.append( y == p[0].op(1) + s*( p[2].op(1) - p[0].op(1))); 00586 ret.append( z == p[0].op(1) + t*( p[2].op(2) - p[0].op(2))); 00587 ret.append( GiNaC::lst(r,0,1)); 00588 ret.append( GiNaC::lst(s,0,1)); 00589 ret.append( GiNaC::lst(t,0,1)); 00590 } 00591 return ret; 00592 }
|
|
Reimplemented from Polygon. Reimplemented in ReferenceRectangle. Definition at line 594 of file Polygon.cpp.
|
|
Reimplemented from Polygon. Reimplemented in ReferenceRectangle. Definition at line 564 of file Polygon.cpp. References Polygon::p. 00564 { 00565 return p[i]; 00566 }
|