1 // Copyright (C) 2007-2019 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, or (at your option) any later version.
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
19 // Author : Anthony Geay (CEA/DEN)
21 #ifndef __INTERPKERNELGEO2DEDGELIN_HXX__
22 #define __INTERPKERNELGEO2DEDGELIN_HXX__
24 #include "INTERPKERNELDefines.hxx"
25 #include "InterpKernelGeo2DEdge.hxx"
27 namespace INTERP_KERNEL
29 class INTERPKERNEL_EXPORT SegSegIntersector : SameTypeEdgeIntersector
33 SegSegIntersector(const EdgeLin& e1, const EdgeLin& e2);
34 bool areColinears() const;
35 bool haveTheySameDirection() const;
36 void getPlacements(Node *start, Node *end, TypeOfLocInEdge& whereStart, TypeOfLocInEdge& whereEnd, MergePoints& commonNode) const;
37 void areOverlappedOrOnlyColinears(bool& obviousNoIntersection, bool& areOverlapped);
38 std::list< IntersectElement > getIntersectionsCharacteristicVal() const;
40 void getCurveAbscisse(Node *node, TypeOfLocInEdge& where, MergePoints& commonNode) const;
42 //! index on which all single index op will be performed. Filled in case colinearity is equal to true.
45 double _matrix[4]; //SPACEDIM*SPACEDIM = [e1_x, e1_y, e2_x, e2_y]
49 class INTERPKERNEL_EXPORT EdgeLin : public Edge
51 friend class SegSegIntersector;
53 EdgeLin(std::istream& lineInXfig);
54 EdgeLin(Node *start, Node *end, bool direction=true);
55 EdgeLin(double sX, double sY, double eX, double eY);
57 TypeOfFunction getTypeOfFunc() const { return SEG; }
58 void dumpInXfigFile(std::ostream& stream, bool direction, int resolution, const Bounds& box) const;
60 double getNormSq() const;
61 double getAreaOfZone() const;
62 double getCurveLength() const;
63 void getBarycenter(double *bary) const;
64 void getBarycenterOfZone(double *bary) const;
65 void getMiddleOfPoints(const double *p1, const double *p2, double *mid) const;
66 bool isIn(double characterVal) const;
67 Node *buildRepresentantOfMySelf() const;
68 double getCharactValue(const Node& node) const;
69 double getCharactValueBtw0And1(const Node& node) const;
70 double getDistanceToPoint(const double *pt) const;
71 bool isNodeLyingOn(const double *coordOfNode) const;
72 bool isLower(double val1, double val2) const { return val1<val2; }
73 double getCharactValueEng(const double *node) const;
74 bool doIHaveSameDirectionAs(const Edge& other) const;
75 void dynCastFunction(const EdgeLin * &seg,
76 const EdgeArcCircle * &arcSeg) const { seg=this; }
80 Edge *buildEdgeLyingOnMe(Node *start, Node *end, bool direction) const;