5 #include "GeoModelKernel/GeoSimplePolygonBrep.h" 6 #include "GeoModelKernel/GeoShapeAction.h" 7 #include "PolygonTriangulator.h" 11 const std::string GeoSimplePolygonBrep::s_classType =
"SimplePolygonBrep";
12 const ShapeType GeoSimplePolygonBrep::s_classTypeID = 0x20;
14 GeoSimplePolygonBrep::GeoSimplePolygonBrep(
double dz)
19 GeoSimplePolygonBrep::~GeoSimplePolygonBrep()
23 double GeoSimplePolygonBrep::volume ()
const 26 throw std::runtime_error (
"Volume requested for incomplete simple polygon brep");
33 double x1, x2, x3, y1, y2, y3;
34 PolygonTriangulator::Triangles::const_iterator it, itE = pt.triangles()->end();
35 for (it = pt.triangles()->begin(); it!=itE; ++it) {
36 x1 = m_xVertices.at(it->at(0)-1);
37 x2 = m_xVertices.at(it->at(1)-1);
38 x3 = m_xVertices.at(it->at(2)-1);
39 y1 = m_yVertices.at(it->at(0)-1);
40 y2 = m_yVertices.at(it->at(1)-1);
41 y3 = m_yVertices.at(it->at(2)-1);
42 area += fabs ( -x2*y1 + x3*y1 + x1 * y2 - x3 * y2 - x1*y3 + x2*y3 );
48 const std::string & GeoSimplePolygonBrep::type()
const 53 ShapeType GeoSimplePolygonBrep::typeID()
const 58 void GeoSimplePolygonBrep::addVertex(
double XVertex,
double YVertex)
60 m_xVertices.push_back(XVertex);
61 m_yVertices.push_back(YVertex);
66 action->handleSimplePolygonBrep(
this);
This class is a visitor for shapes. It allows a navigation of the boolean expression tree for shapes...