1 // Copyright (C) 2007-2012 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef __INTERPKERNELGEO2DEDGELIN_HXX__
21 #define __INTERPKERNELGEO2DEDGELIN_HXX__
23 #include "INTERPKERNELDefines.hxx"
24 #include "InterpKernelGeo2DEdge.hxx"
26 namespace INTERP_KERNEL
28 class INTERPKERNEL_EXPORT SegSegIntersector : SameTypeEdgeIntersector
32 SegSegIntersector(const EdgeLin& e1, const EdgeLin& e2);
33 bool areColinears() const;
34 bool haveTheySameDirection() const;
35 void getPlacements(Node *start, Node *end, TypeOfLocInEdge& whereStart, TypeOfLocInEdge& whereEnd, MergePoints& commonNode) const;
36 void areOverlappedOrOnlyColinears(const Bounds *whereToFind, bool& obviousNoIntersection, bool& areOverlapped);
37 std::list< IntersectElement > getIntersectionsCharacteristicVal() const;
39 void getCurveAbscisse(Node *node, TypeOfLocInEdge& where, MergePoints& commonNode) const;
41 //! index on which all single index op will be performed. Filled in case colinearity is equal to true.
44 double _matrix[4];//SPACEDIM*SPACEDIM
47 class INTERPKERNEL_EXPORT EdgeLin : public Edge
49 friend class SegSegIntersector;
51 EdgeLin(std::istream& lineInXfig);
52 EdgeLin(Node *start, Node *end, bool direction=true);
53 EdgeLin(double sX, double sY, double eX, double eY);
55 TypeOfFunction getTypeOfFunc() const { return SEG; }
56 void dumpInXfigFile(std::ostream& stream, bool direction, int resolution, const Bounds& box) const;
58 double getNormSq() const;
59 double getAreaOfZone() const;
60 double getCurveLength() const;
61 void getBarycenter(double *bary) const;
62 void getBarycenterOfZone(double *bary) const;
63 bool isIn(double characterVal) const;
64 Node *buildRepresentantOfMySelf() const;
65 double getCharactValue(const Node& node) const;
66 double getCharactValueBtw0And1(const Node& node) const;
67 double getDistanceToPoint(const double *pt) const;
68 bool isNodeLyingOn(const double *coordOfNode) const;
69 bool isLower(double val1, double val2) const { return val1<val2; }
70 double getCharactValueEng(const double *node) const;
71 bool doIHaveSameDirectionAs(const Edge& other) const;
72 void dynCastFunction(const EdgeLin * &seg,
73 const EdgeArcCircle * &arcSeg) const { seg=this; }
77 Edge *buildEdgeLyingOnMe(Node *start, Node *end, bool direction) const;
78 void fillGlobalInfoAbs(bool direction, const std::map<INTERP_KERNEL::Node *,int>& mapThis, const std::map<INTERP_KERNEL::Node *,int>& mapOther, int offset1, int offset2, double fact, double baryX, double baryY,
79 std::vector<int>& edgesThis, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,int> mapAddCoo) const;
80 void fillGlobalInfoAbs2(const std::map<INTERP_KERNEL::Node *,int>& mapThis, const std::map<INTERP_KERNEL::Node *,int>& mapOther, int offset1, int offset2, double fact, double baryX, double baryY,
81 std::vector<int>& edgesOther, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,int>& mapAddCoo) const;