Back to index

salome-med  6.5.0
InterpKernelGeo2DEdgeLin.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 #ifndef __INTERPKERNELGEO2DEDGELIN_HXX__
00021 #define __INTERPKERNELGEO2DEDGELIN_HXX__
00022 
00023 #include "INTERPKERNELDefines.hxx"
00024 #include "InterpKernelGeo2DEdge.hxx"
00025 
00026 namespace INTERP_KERNEL
00027 {
00028   class INTERPKERNEL_EXPORT SegSegIntersector : SameTypeEdgeIntersector
00029     {
00030       friend class Edge;
00031     public:
00032       SegSegIntersector(const EdgeLin& e1, const EdgeLin& e2);
00033       bool areColinears() const;
00034       bool haveTheySameDirection() const;
00035       void getPlacements(Node *start, Node *end, TypeOfLocInEdge& whereStart, TypeOfLocInEdge& whereEnd, MergePoints& commonNode) const;
00036       void areOverlappedOrOnlyColinears(const Bounds *whereToFind, bool& obviousNoIntersection, bool& areOverlapped);
00037       std::list< IntersectElement > getIntersectionsCharacteristicVal() const;
00038     private:
00039       void getCurveAbscisse(Node *node, TypeOfLocInEdge& where, MergePoints& commonNode) const;
00040     private:
00042       int _ind;
00043       double _col[2];
00044       double _matrix[4];//SPACEDIM*SPACEDIM
00045     };
00046 
00047   class INTERPKERNEL_EXPORT EdgeLin : public Edge
00048   {
00049     friend class SegSegIntersector;
00050   public:
00051     EdgeLin(std::istream& lineInXfig);
00052     EdgeLin(Node *start, Node *end, bool direction=true);
00053     EdgeLin(double sX, double sY, double eX, double eY);
00054     ~EdgeLin();
00055     TypeOfFunction getTypeOfFunc() const { return SEG; }
00056     void dumpInXfigFile(std::ostream& stream, bool direction, int resolution, const Bounds& box) const;
00057     void update(Node *m);
00058     double getNormSq() const;
00059     double getAreaOfZone() const;
00060     double getCurveLength() const;
00061     void getBarycenter(double *bary) const;
00062     void getBarycenterOfZone(double *bary) const;
00063     bool isIn(double characterVal) const;
00064     Node *buildRepresentantOfMySelf() const;
00065     double getCharactValue(const Node& node) const;
00066     double getCharactValueBtw0And1(const Node& node) const;
00067     double getDistanceToPoint(const double *pt) const;
00068     bool isNodeLyingOn(const double *coordOfNode) const;
00069     bool isLower(double val1, double val2) const { return val1<val2; }
00070     double getCharactValueEng(const double *node) const;
00071     bool doIHaveSameDirectionAs(const Edge& other) const;
00072     void dynCastFunction(const EdgeLin * &seg,
00073                          const EdgeArcCircle * &arcSeg) const { seg=this; }
00074   protected:
00075     EdgeLin() { }
00076     void updateBounds();
00077     Edge *buildEdgeLyingOnMe(Node *start, Node *end, bool direction) const;
00078     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,
00079                            std::vector<int>& edgesThis, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,int> mapAddCoo) const;
00080     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,
00081                             std::vector<int>& edgesOther, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,int>& mapAddCoo) const;
00082   };
00083 }
00084 
00085 #endif