Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __INTERPKERNELGEO2DQUADRATICPOLYGON_HXX__
00021 #define __INTERPKERNELGEO2DQUADRATICPOLYGON_HXX__
00022
00023 #include "INTERPKERNELGEOMETRIC2DDefines.hxx"
00024
00025 #include "InterpKernelGeo2DComposedEdge.hxx"
00026 #include "InterpKernelGeo2DAbstractEdge.hxx"
00027 #include "InterpKernelGeo2DElementaryEdge.hxx"
00028
00029 #include <list>
00030 #include <vector>
00031
00032 namespace INTERP_KERNEL
00033 {
00034 class Edge;
00035 class MergePoints;
00036
00037 class INTERPKERNELGEOMETRIC2D_EXPORT QuadraticPolygon : public ComposedEdge
00038 {
00039 public:
00040 QuadraticPolygon() { }
00041 QuadraticPolygon(const QuadraticPolygon& other):ComposedEdge(other) { }
00042 QuadraticPolygon(const char *fileName);
00043 static QuadraticPolygon *buildLinearPolygon(std::vector<Node *>& nodes);
00044 static QuadraticPolygon *buildArcCirclePolygon(std::vector<Node *>& nodes);
00045 static void buildDbgFile(const std::vector<Node *>& nodes, const char *fileName);
00046 ~QuadraticPolygon();
00047 void closeMe() const;
00048 void circularPermute();
00049 bool isButterfly() const;
00050 void dumpInXfigFile(const char *fileName) const;
00051 void dumpInXfigFileWithOther(const ComposedEdge& other, const char *fileName) const;
00053 double intersectWithAbs(QuadraticPolygon& other);
00055 double intersectWithAbs(QuadraticPolygon& other, double* barycenter);
00056 double intersectWith(const QuadraticPolygon& other) const;
00057 double intersectWith(const QuadraticPolygon& other, double* barycenter) const;
00058 std::vector<QuadraticPolygon *> intersectMySelfWith(const QuadraticPolygon& other) const;
00059 void intersectForPerimeter(const QuadraticPolygon& other, double& perimeterThisPart, double& perimeterOtherPart, double& perimeterCommonPart) const;
00060 void intersectForPerimeterAdvanced(const QuadraticPolygon& other, std::vector< double >& polThis, std::vector< double >& polOther) const;
00061 void intersectForPoint(const QuadraticPolygon& other, std::vector< int >& numberOfCreatedPointsPerEdge) const;
00062 public:
00063 void performLocatingOperation(QuadraticPolygon& pol2) const;
00064 static void splitPolygonsEachOther(QuadraticPolygon& pol1, QuadraticPolygon& pol2, int& nbOfSplits);
00065 std::vector<QuadraticPolygon *> buildIntersectionPolygons(const QuadraticPolygon& pol1, const QuadraticPolygon& pol2) const;
00066 bool amIAChanceToBeCompletedBy(const QuadraticPolygon& pol1Splitted, const QuadraticPolygon& pol2NotSplitted, bool& direction);
00067 protected:
00068 std::list<QuadraticPolygon *> zipConsecutiveInSegments() const;
00069 void dumpInXfigFile(std::ostream& stream, int resolution, const Bounds& box) const;
00070 void closePolygons(std::list<QuadraticPolygon *>& pol2Zip, const QuadraticPolygon& pol1, std::vector<QuadraticPolygon *>& results) const;
00071 template<class EDGES>
00072 static void updateNeighbours(const MergePoints& merger, IteratorOnComposedEdge it1, IteratorOnComposedEdge it2,
00073 const EDGES *e1, const EDGES *e2);
00074 std::list<QuadraticPolygon *>::iterator fillAsMuchAsPossibleWith(const QuadraticPolygon& pol1Splitted,
00075 std::list<QuadraticPolygon *>::iterator iStart,
00076 std::list<QuadraticPolygon *>::iterator iEnd,
00077 bool direction);
00078 static std::list<QuadraticPolygon *>::iterator checkInList(Node *n, std::list<QuadraticPolygon *>::iterator iStart,
00079 std::list<QuadraticPolygon *>::iterator iEnd);
00080 };
00081 }
00082
00083 namespace INTERP_KERNEL
00084 {
00085 template<class EDGES>
00086 void QuadraticPolygon::updateNeighbours(const MergePoints& merger, IteratorOnComposedEdge it1, IteratorOnComposedEdge it2,
00087 const EDGES *e1, const EDGES *e2)
00088 {
00089 it1.previousLoop(); it2.previousLoop();
00090 ElementaryEdge *curE1=it1.current(); ElementaryEdge *curE2=it2.current();
00091 curE1->changeEndNodeWith(e1->getStartNode()); curE2->changeEndNodeWith(e2->getStartNode());
00092 it1.nextLoop(); it1.nextLoop(); it2.nextLoop(); it2.nextLoop();
00093 curE1->changeStartNodeWith(e1->getEndNode()); curE2->changeStartNodeWith(e2->getEndNode());
00094 }
00095 }
00096
00097 #endif