*/
double ArcCArcCIntersector::getAngle(Node *node) const
{
- return EdgeArcCircle::GetAbsoluteAngleOfNormalizedVect(((*node)[0]-getE1().getCenter()[0])/getE1().getRadius(),((*node)[1]-getE1().getCenter()[1])/getE1().getRadius());
+ return EdgeArcCircle::GetAbsoluteAngleOfVector((*node)[0]-getE1().getCenter()[0],(*node)[1]-getE1().getCenter()[1]);
}
bool ArcCArcCIntersector::internalAreColinears(const EdgeArcCircle& a1, const EdgeArcCircle& a2, double& distBetweenCenters, double& cst,
tmp=sqrt(tmp);
if(Node::areDoubleEqualsWPLeft(tmp,0.,10*std::max(radiusL,radiusB)))
return Node::areDoubleEquals(radiusL,radiusB);
- double phi=EdgeArcCircle::GetAbsoluteAngleOfNormalizedVect((centerL[0]-centerB[0])/tmp,(centerL[1]-centerB[1])/tmp);
+ double phi=EdgeArcCircle::GetAbsoluteAngleOfVector(centerL[0]-centerB[0],centerL[1]-centerB[1]);
double cst2=2*radiusL*tmp/(radiusB*radiusB);
double cmpContainer[4];
int sizeOfCmpContainer=2;
v2[0]=u[0]*d1_1+u[1]*d1_1y; v2[1]=u[1]*d1_1-u[0]*d1_1y;
Node *node1=new Node(center1[0]+v1[0],center1[1]+v1[1]); node1->declareOn();
Node *node2=new Node(center1[0]+v2[0],center1[1]+v2[1]); node2->declareOn();
- double angle1_1=EdgeArcCircle::GetAbsoluteAngleOfNormalizedVect(v1[0]/radius1,v1[1]/radius1);
- double angle2_1=EdgeArcCircle::GetAbsoluteAngleOfNormalizedVect(v2[0]/radius1,v2[1]/radius1);
+ double angle1_1=EdgeArcCircle::GetAbsoluteAngleOfVector(v1[0],v1[1]);
+ double angle2_1=EdgeArcCircle::GetAbsoluteAngleOfVector(v2[0],v2[1]);
double v3[2],v4[2];
v3[0]=center1[0]-center2[0]+v1[0]; v3[1]=center1[1]-center2[1]+v1[1];
v4[0]=center1[0]-center2[0]+v2[0]; v4[1]=center1[1]-center2[1]+v2[1];
- double angle1_2=EdgeArcCircle::GetAbsoluteAngleOfNormalizedVect(v3[0]/radius2,v3[1]/radius2);
- double angle2_2=EdgeArcCircle::GetAbsoluteAngleOfNormalizedVect(v4[0]/radius2,v4[1]/radius2);
+ double angle1_2=EdgeArcCircle::GetAbsoluteAngleOfVector(v3[0],v3[1]);
+ double angle2_2=EdgeArcCircle::GetAbsoluteAngleOfVector(v4[0],v4[1]);
// Check whether intersection points are exactly ON the other arc or not
// -> the curvilinear distance (=radius*angle) must below eps
bool e1_1S=Node::areDoubleEqualsWPLeft(angle1_1,getE1().getAngle0(),radius1);
double v1[2],v2[2];
v1[0]=d1_1*u[0]; v1[1]=d1_1*u[1];
v2[0]=center1[0]-center2[0]+v1[0]; v2[1]=center1[1]-center2[1]+v1[1];
- double angle0_1=EdgeArcCircle::GetAbsoluteAngleOfNormalizedVect(v1[0]/radius1,v1[1]/radius1);
- double angle0_2=EdgeArcCircle::GetAbsoluteAngleOfNormalizedVect(v2[0]/radius2,v2[1]/radius2);
+ double angle0_1=EdgeArcCircle::GetAbsoluteAngleOfVector(v1[0],v1[1]);
+ double angle0_2=EdgeArcCircle::GetAbsoluteAngleOfVector(v2[0],v2[1]);
bool e0_1S=Node::areDoubleEqualsWPLeft(angle0_1,getE1().getAngle0(),radius1);
bool e0_1E=Node::areDoubleEqualsWPLeft(angle0_1,angleE1,radius1);
bool e0_2S=Node::areDoubleEqualsWPLeft(angle0_2,getE2().getAngle0(),radius2);
Edge *EdgeArcCircle::buildEdgeLyingOnMe(Node *start, Node *end, bool direction) const
{
- double sx=((*start)[0]-_center[0])/_radius;
- double sy=((*start)[1]-_center[1])/_radius;
- double ex=((*end)[0]-_center[0])/_radius;
- double ey=((*end)[1]-_center[1])/_radius;
- double angle0=GetAbsoluteAngleOfNormalizedVect(direction?sx:ex,direction?sy:ey);
- double deltaAngle=GetAbsoluteAngleOfNormalizedVect(sx*ex+sy*ey,sx*ey-sy*ex);
+ double sx=(*start)[0]-_center[0];
+ double sy=(*start)[1]-_center[1];
+ double ex=(*end)[0]-_center[0];
+ double ey=(*end)[1]-_center[1];
+ double angle0=GetAbsoluteAngleOfVector(direction?sx:ex,direction?sy:ey);
+ double deltaAngle=GetAbsoluteAngleOfVector(sx*ex+sy*ey,sx*ey-sy*ex);
if(deltaAngle>0. && _angle<0.)
deltaAngle-=2.*M_PI;
else if(deltaAngle<0. && _angle>0.)
}
}
-/*!
- * Given an \b NON normalized vector 'vect', returns its norm 'normVect' and its
- * angle in ]-Pi,Pi] relative to Ox axe.
- */
-double EdgeArcCircle::GetAbsoluteAngle(const double *vect, double& normVect)
-{
- normVect=Node::norm(vect);
- return GetAbsoluteAngleOfNormalizedVect(vect[0]/normVect,vect[1]/normVect);
-}
-
/*!
* Given a \b normalized vector defined by (ux,uy) returns its angle in ]-Pi;Pi].
* Actually in the current implementation, the vector does not even need to be normalized ...
*/
-double EdgeArcCircle::GetAbsoluteAngleOfNormalizedVect(double ux, double uy)
+double EdgeArcCircle::GetAbsoluteAngleOfVector(double ux, double uy)
{
return atan2(uy, ux);
}
center[0]=((end[1]-middle[1])*b1+(start[1]-middle[1])*b2)/delta;
center[1]=((middle[0]-end[0])*b1+(middle[0]-start[0])*b2)/delta;
radius=SafeSqrt((start[0]-center[0])*(start[0]-center[0])+(start[1]-center[1])*(start[1]-center[1]));
- angleInRad0=GetAbsoluteAngleOfNormalizedVect((start[0]-center[0])/radius,(start[1]-center[1])/radius);
- double angleInRadM=GetAbsoluteAngleOfNormalizedVect((middle[0]-center[0])/radius,(middle[1]-center[1])/radius);
- angleInRad=GetAbsoluteAngleOfNormalizedVect(((start[0]-center[0])*(end[0]-center[0])+(start[1]-center[1])*(end[1]-center[1]))/(radius*radius),
- ((start[0]-center[0])*(end[1]-center[1])-(start[1]-center[1])*(end[0]-center[0]))/(radius*radius));
+ angleInRad0=GetAbsoluteAngleOfVector(start[0]-center[0],start[1]-center[1]);
+ double angleInRadM=GetAbsoluteAngleOfVector(middle[0]-center[0],middle[1]-center[1]);
+ angleInRad=GetAbsoluteAngleOfVector((start[0]-center[0])*(end[0]-center[0])+(start[1]-center[1])*(end[1]-center[1]),
+ (start[0]-center[0])*(end[1]-center[1])-(start[1]-center[1])*(end[0]-center[0]));
if(IsAngleNotIn(angleInRad0,angleInRad,angleInRadM))
angleInRad=angleInRad<0?2*M_PI+angleInRad:angleInRad-2*M_PI;
}
*/
void EdgeArcCircle::getMiddleOfPoints(const double *p1, const double *p2, double *mid) const
{
- double dx1((p1[0]-_center[0])/_radius),dy1((p1[1]-_center[1])/_radius),dx2((p2[0]-_center[0])/_radius),dy2((p2[1]-_center[1])/_radius);
- double angle1(GetAbsoluteAngleOfNormalizedVect(dx1,dy1)),angle2(GetAbsoluteAngleOfNormalizedVect(dx2,dy2));
+ double dx1(p1[0]-_center[0]),dy1(p1[1]-_center[1]),dx2(p2[0]-_center[0]),dy2(p2[1]-_center[1]);
+ double angle1(GetAbsoluteAngleOfVector(dx1,dy1)),angle2(GetAbsoluteAngleOfVector(dx2,dy2));
//
double myDelta1(angle1-_angle0),myDelta2(angle2-_angle0);
if(_angle>0.)
*/
void EdgeArcCircle::getMiddleOfPointsOriented(const double *p1, const double *p2, double *mid) const
{
- double dx1((p1[0]-_center[0])/_radius),dy1((p1[1]-_center[1])/_radius),dx2((p2[0]-_center[0])/_radius),dy2((p2[1]-_center[1])/_radius);
- double angle1(GetAbsoluteAngleOfNormalizedVect(dx1,dy1)),angle2(GetAbsoluteAngleOfNormalizedVect(dx2,dy2));
+ double dx1(p1[0]-_center[0]),dy1(p1[1]-_center[1]),dx2(p2[0]-_center[0]),dy2(p2[1]-_center[1]);
+ double angle1(GetAbsoluteAngleOfVector(dx1,dy1)),angle2(GetAbsoluteAngleOfVector(dx2,dy2));
if (angle1 <= 0.0)
angle1 += 2.*M_PI;
*/
double EdgeArcCircle::getCharactValue(const Node& node) const
{
- double dx=(node[0]-_center[0])/_radius;
- double dy=(node[1]-_center[1])/_radius;
- return GetAbsoluteAngleOfNormalizedVect(dx,dy);
+ double dx=node[0]-_center[0];
+ double dy=node[1]-_center[1];
+ return GetAbsoluteAngleOfVector(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 dx=node[0]-_center[0];
+ double dy=node[1]-_center[1];
+ double angle=GetAbsoluteAngleOfVector(dx,dy);
//
double myDelta=angle-_angle0;
if(_angle>0.)