b.getBarycenter(xBary,yBary);
for(std::vector<Node *>::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<double,Node *> > an2(sz);
for(std::size_t i=0;i<sz;i++)
- an2[i]=std::pair<double,Node *>(getCharactValue(*addNodes[i]),addNodes[i]);
+ an2[i]=std::pair<double,Node *>(getCharactValueBtw0And1(*addNodes[i]),addNodes[i]);
std::sort(an2.begin(),an2.end());
int startId=(*mapp1.find(_start)).second;
int endId=(*mapp1.find(_end)).second;
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).
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);
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; }
return getCharactValueEng(node);
}
+double EdgeLin::getCharactValueBtw0And1(const Node& node) const
+{
+ return getCharactValueEng(node);
+}
+
double EdgeLin::getDistanceToPoint(const double *pt) const
{
double loc=getCharactValueEng(pt);
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<val2; }