1 // Copyright (C) 2007-2008 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
19 #ifndef __EDGELIN_HXX__
20 #define __EDGELIN_HXX__
24 namespace INTERP_KERNEL
26 class SegSegIntersector : SameTypeEdgeIntersector
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;
37 void getCurveAbscisse(Node *node, TypeOfLocInEdge& where, MergePoints& commonNode) const;
39 //! index on which all single index op will be performed. Filled in case colinearity is equal to true.
42 double _matrix[4];//SPACEDIM*SPACEDIM
45 class EdgeLin : public Edge
47 friend class SegSegIntersector;
49 EdgeLin(std::istream& lineInXfig);
50 EdgeLin(Node *start, Node *end, bool direction=true);
51 EdgeLin(double sX, double sY, double eX, double eY);
53 TypeOfFunction getTypeOfFunc() const { return SEG; }
54 void dumpInXfigFile(std::ostream& stream, bool direction, int resolution, const Bounds& box) const;
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; }
74 Edge *buildEdgeLyingOnMe(Node *start, Node *end, bool direction) const;