From 8b80257532aecf505bf7e7ddb0cf842c0fcdabed Mon Sep 17 00:00:00 2001 From: ageay Date: Fri, 17 Feb 2012 12:22:58 +0000 Subject: [PATCH] Addition of characteristic value between 0 and 1 for inside points. --- .../Geometric2D/InterpKernelGeo2DEdge.cxx | 3 ++- .../Geometric2D/InterpKernelGeo2DEdge.hxx | 2 ++ .../Geometric2D/InterpKernelGeo2DEdgeArcCircle.cxx | 14 ++++++++++++++ .../Geometric2D/InterpKernelGeo2DEdgeArcCircle.hxx | 1 + .../Geometric2D/InterpKernelGeo2DEdgeLin.cxx | 5 +++++ .../Geometric2D/InterpKernelGeo2DEdgeLin.hxx | 1 + 6 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.cxx index ac1f191a0..43ba9fdd3 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.cxx @@ -870,12 +870,13 @@ void Edge::sortIdsAbs(const std::vector& addNodes, const b.getBarycenter(xBary,yBary); for(std::vector::const_iterator iter=addNodes.begin();iter!=addNodes.end();iter++) (*iter)->applySimilarity(xBary,yBary,dimChar); + applySimilarity(xBary,yBary,dimChar); _start->applySimilarity(xBary,yBary,dimChar); _end->applySimilarity(xBary,yBary,dimChar); std::size_t sz=addNodes.size(); std::vector< std::pair > an2(sz); for(std::size_t i=0;i(getCharactValue(*addNodes[i]),addNodes[i]); + an2[i]=std::pair(getCharactValueBtw0And1(*addNodes[i]),addNodes[i]); std::sort(an2.begin(),an2.end()); int startId=(*mapp1.find(_start)).second; int endId=(*mapp1.find(_end)).second; diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.hxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.hxx index 9f2a10703..f8ec78822 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.hxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.hxx @@ -243,6 +243,8 @@ namespace INTERP_KERNEL virtual bool isLower(double val1, double val2) const = 0; //! node is expected to lay on 'this'. It returns a characteristic magnitude usable by isIn method. virtual double getCharactValue(const Node& node) const = 0; + //! node is expected to lay on 'this'. It returns a characteristic magnitude between 0 and 1. + virtual double getCharactValueBtw0And1(const Node& node) const = 0; //! retrieves the distance to this : The min distance from pt and any point of this. virtual double getDistanceToPoint(const double *pt) const = 0; //! return if node with coords 'coordOfNode' is on this (with precision). diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.cxx index 7f2220963..8c6343740 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.cxx @@ -674,6 +674,20 @@ double EdgeArcCircle::getCharactValue(const Node& node) const return GetAbsoluteAngleOfNormalizedVect(dx,dy); } +double EdgeArcCircle::getCharactValueBtw0And1(const Node& node) const +{ + double dx=(node[0]-_center[0])/_radius; + double dy=(node[1]-_center[1])/_radius; + double angle=GetAbsoluteAngleOfNormalizedVect(dx,dy); + // + double myDelta=angle-_angle0; + if(_angle>0.) + myDelta=myDelta>=0.?myDelta:myDelta+2.*M_PI; + else + myDelta=myDelta<=0.?myDelta:myDelta-2.*M_PI; + return myDelta/_angle; +} + double EdgeArcCircle::getDistanceToPoint(const double *pt) const { double angle=Node::computeAngle(_center,pt); diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.hxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.hxx index 582631fe8..3c3e48fbe 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.hxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.hxx @@ -82,6 +82,7 @@ namespace INTERP_KERNEL Node *buildRepresentantOfMySelf() const; bool isLower(double val1, double val2) const; double getCharactValue(const Node& node) const; + double getCharactValueBtw0And1(const Node& node) const; double getDistanceToPoint(const double *pt) const; bool isNodeLyingOn(const double *coordOfNode) const; TypeOfFunction getTypeOfFunc() const { return ARC_CIRCLE; } diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeLin.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeLin.cxx index 455115de8..a61d85ec1 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeLin.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeLin.cxx @@ -180,6 +180,11 @@ double EdgeLin::getCharactValue(const Node& node) const return getCharactValueEng(node); } +double EdgeLin::getCharactValueBtw0And1(const Node& node) const +{ + return getCharactValueEng(node); +} + double EdgeLin::getDistanceToPoint(const double *pt) const { double loc=getCharactValueEng(pt); diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeLin.hxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeLin.hxx index a5ece3cb4..299e98bf9 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeLin.hxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeLin.hxx @@ -63,6 +63,7 @@ namespace INTERP_KERNEL bool isIn(double characterVal) const; Node *buildRepresentantOfMySelf() const; double getCharactValue(const Node& node) const; + double getCharactValueBtw0And1(const Node& node) const; double getDistanceToPoint(const double *pt) const; bool isNodeLyingOn(const double *coordOfNode) const; bool isLower(double val1, double val2) const { return val1