]> SALOME platform Git repositories - tools/medcoupling.git/blob - src/INTERP_KERNEL/Geometric2D/EdgeLin.hxx
Salome HOME
Merge from BR_V5_DEV 16Feb09
[tools/medcoupling.git] / src / INTERP_KERNEL / Geometric2D / EdgeLin.hxx
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D
2 //
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.
7 //
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.
12 //
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
16 //
17 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 #ifndef __EDGELIN_HXX__
20 #define __EDGELIN_HXX__
21
22 #include "Edge.hxx"
23
24 namespace INTERP_KERNEL
25 {
26   class SegSegIntersector : SameTypeEdgeIntersector
27     {
28       friend class Edge;
29     public:
30       SegSegIntersector(const EdgeLin& e1, const EdgeLin& e2);
31       bool areColinears() const;
32       bool haveTheySameDirection() const;
33       void getPlacements(Node *start, Node *end, TypeOfLocInEdge& whereStart, TypeOfLocInEdge& whereEnd, MergePoints& commonNode) const;
34       void areOverlappedOrOnlyColinears(const Bounds *whereToFind, bool& obviousNoIntersection, bool& areOverlapped);
35       std::list< IntersectElement > getIntersectionsCharacteristicVal() const;
36     private:
37       void getCurveAbscisse(Node *node, TypeOfLocInEdge& where, MergePoints& commonNode) const;
38     private:
39       //! index on which all single index op will be performed. Filled in case colinearity is equal to true.
40       int _ind;
41       double _col[2];
42       double _matrix[4];//SPACEDIM*SPACEDIM
43     };
44
45   class EdgeLin : public Edge
46   {
47     friend class SegSegIntersector;
48   public:
49     EdgeLin(std::istream& lineInXfig);
50     EdgeLin(Node *start, Node *end, bool direction=true);
51     EdgeLin(double sX, double sY, double eX, double eY);
52     ~EdgeLin();
53     TypeOfFunction getTypeOfFunc() const { return SEG; }
54     void dumpInXfigFile(std::ostream& stream, bool direction, int resolution, const Bounds& box) const;
55     void update(Node *m);
56     double getNormSq() const;
57     double getAreaOfZone() const;
58     double getCurveLength() const;
59     void getBarycenter(double *bary) const;
60     void getBarycenterOfZone(double *bary) const;
61     bool isIn(double characterVal) const;
62     Node *buildRepresentantOfMySelf() const;
63     double getCharactValue(const Node& node) const;
64     double getDistanceToPoint(const double *pt) const;
65     bool isNodeLyingOn(const double *coordOfNode) const;
66     bool isLower(double val1, double val2) const { return val1<val2; }
67     double getCharactValueEng(const double *node) const;
68     bool doIHaveSameDirectionAs(const Edge& other) const;
69     void dynCastFunction(const EdgeLin * &seg,
70                          const EdgeArcCircle * &arcSeg) const { seg=this; }
71   protected:
72     EdgeLin() { }
73     void updateBounds();
74     Edge *buildEdgeLyingOnMe(Node *start, Node *end, bool direction) const;
75   };
76 }
77
78 #endif