本文整理汇总了C++中Point::GetAngleTo方法的典型用法代码示例。如果您正苦于以下问题:C++ Point::GetAngleTo方法的具体用法?C++ Point::GetAngleTo怎么用?C++ Point::GetAngleTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point
的用法示例。
在下文中一共展示了Point::GetAngleTo方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getSCC_Relation_String
/*****************************************************************************
*** Single-Cross Calculus (SCC)
*****************************************************************************/
std::string getSCC_Relation_String( int m, Point ptOrigin, Point ptRelatum, Point ptReferent) {
if(ptOrigin == ptRelatum) {
// return ":error";
// dou/tri not included in the original definition
if(ptOrigin == ptReferent) {
return "tri";
} else {
return "dou";
}
}
// Point origin( 0,0 );
CAngle angle;
char cString[20];
std::string sResult;
// Teil 1: A,B ? C
if( ptRelatum == ptReferent) {
return (std::string)"b";
// sprintf( cString, "%c\0", 'b');
} else {
Point c( ptReferent );
angle = -ptOrigin.GetAngleTo( ptRelatum );
c.Rotate( angle.get(), ptRelatum );
sprintf( cString, "%d\0", calculateOrientationSegmentOPRA( 2, ptRelatum.GetAngleTo( c ) ));
}
sResult += cString;
return sResult;
}
示例2: ptOrigin
std::vector< int > getOPRA_Relation3(int m,
Point ptA, double oriA,
Point ptB, double oriB) {
int relAB, relBA;
Point ptOrigin( 0,0 );
std::vector< int > result;
CAngle cangleA(oriA);
CAngle cangleB(oriB);
CAngle cangleAB = ptA.GetAngleTo( ptB );
CAngle cangleBA = ptB.GetAngleTo( ptA );
CAngle angleI = cangleAB - cangleA + cangleB;
CAngle angleJ = cangleBA - cangleB + cangleA;
relAB = calculateOrientationSegmentOPRA( m, angleI.get() );
relBA = calculateOrientationSegmentOPRA( m, angleJ.get() );
if( ptA == ptB ) {
result.push_back( relBA );
} else {
result.push_back( relAB );
result.push_back( relBA );
}
return result;
}
示例3: getQTC_Relation_String
std::string getQTC_Relation_String( Point pt_K1, Point pt_K2, Point pt_L1, Point pt_L2){
std::string sResult;
std::vector< int > relation_C13;
std::vector< int > relation_C24;
// Result: [Rel_K1_K2, Rel_K2_K1]
relation_C13 = getOPRA_Relation(2, pt_K1, pt_K1.GetAngleTo(pt_L1), pt_K2, pt_K2.GetAngleTo(pt_K1));
// Result: [Rel_L1_L2, Rel_L2_L1]
relation_C24 = getOPRA_Relation(2, pt_L1, pt_K1.GetAngleTo(pt_L1), pt_K2, pt_L2.GetAngleTo(pt_L1));
// C1: K with respect to L1 (front/back)
if( relation_C13[0]==0 || relation_C13[0]==1 || relation_C13[0]==7 ){ sResult += "-";}
else if( relation_C13[0]==2 || relation_C13[0]==6 ){ sResult += "0";}
else if( relation_C13[0]==3 || relation_C13[0]==4 || relation_C13[0]==5 ){ sResult += "+";}
else { cout << "PROBLEMS C1" << endl;}
// C2: L with respect to K1 (front/back)
if( relation_C24[0]==0 || relation_C24[0]==1 || relation_C24[0]==7 ){ sResult += "-";}
else if( relation_C24[0]==2 || relation_C24[0]==6 ){ sResult += "0";}
else if( relation_C24[0]==3 || relation_C24[0]==4 || relation_C24[0]==5 ){ sResult += "+";}
else { cout << "PROBLEMS C2" << endl;}
// C3: K with respect to K1/L1 (left/right)
if( relation_C13[0]==1 || relation_C13[0]==2 || relation_C13[0]==3 ){ sResult += "-";}
else if( relation_C13[0]==0 || relation_C13[0]==4 ){ sResult += "0";}
else if( relation_C13[0]==5 || relation_C13[0]==6 || relation_C13[0]==7 ){ sResult += "+";}
else { cout << "PROBLEMS C3" << endl;}
// C4: L with respect to L1/¬K1 (left/right)
if( relation_C24[0]==1 || relation_C24[0]==2 || relation_C24[0]==3 ){ sResult += "-";}
else if( relation_C24[0]==0 || relation_C24[0]==4 ){ sResult += "0";}
else if( relation_C24[0]==5 || relation_C24[0]==6 || relation_C24[0]==7 ){ sResult += "+";}
else { cout << "PROBLEMS C4" << endl;}
return sResult;
}
示例4: cangleA
std::vector< int > getOPRA_Relation2(int m,
Point ptA, double oriA,
Point ptB, double oriB) {
int relAB, relBA;
std::vector< int > result;
CAngle cangleA(oriA);
CAngle cangleB(oriB);
BB_DBG(2) << "Punkt A: " << ptA << ":" << cangleA << " & Punkt B: " << ptB << ":" << cangleB << endl;
ptB.Rotate( -cangleA.get(), ptA );
cangleB = cangleB - cangleA;
BB_DBG(2) << "Punkt A: " << ptA << ":" << cangleA-cangleA << " & Punkt B: " << ptB << ":" << cangleB << endl;
CAngle cangleAB = ptA.GetAngleTo( ptB );
CAngle cangleBA = ptB.GetAngleTo( ptA );
cangleBA -= cangleB;
BB_DBG(2) << "Relative Angle: (AB:" << cangleAB << ") & (BA:" << cangleBA << ")" << endl;
relAB = calculateOrientationSegmentOPRA( m, cangleAB.get() );
relBA = calculateOrientationSegmentOPRA( m, cangleBA.get() );
if( ptA == ptB ) {
result.push_back( relBA );
} else {
result.push_back( relAB );
result.push_back( relBA );
}
return result;
}
示例5: getDCC_Relation_String
/*****************************************************************************
*** Double-Cross Calculus (DCC)
*****************************************************************************/
std::string getDCC_Relation_String( int m, Point ptOrigin, Point ptRelatum, Point ptReferent) {
CAngle angle;
char cString[20];
std::string sResult;
// Now orientation given if origin == relatum => i (following [Fre92])
if( ptOrigin == ptRelatum) {
if( ptRelatum == ptReferent) {
return (std::string)"tri"; // A = B = C => 'tri'
} else {
return (std::string)"dou"; // A = B != C => 'dou'
}
// sprintf( cString, "%c\0", 'b');
}
// Teil 1: A,B ? C
if( ptRelatum == ptReferent) {
return (std::string)"b_4";
// sprintf( cString, "%c\0", 'b');
} else {
Point c( ptReferent );
angle = -ptOrigin.GetAngleTo( ptRelatum );
c.Rotate( angle.get(), ptRelatum );
sprintf( cString, "%d_\0", calculateOrientationSegmentOPRA( m, ptRelatum.GetAngleTo( c ) ));
}
sResult += cString;
// Teil 2: B,A ? C
if( ptOrigin == ptReferent) {
// sprintf( cString, "%c\0", 'a');
return (std::string)"4_a";
} else {
Point c( ptReferent );
angle = -ptRelatum.GetAngleTo( ptOrigin );
c.Rotate( angle.get(), ptOrigin );
sprintf( cString, "%d\0", calculateOrientationSegmentOPRA( m, ptOrigin.GetAngleTo( c ) ));
}
sResult += cString;
return sResult;
}
示例6: lineA
//.........这里部分代码省略.........
for( unsigned int i=0; i<4; i++) {
if(result[i]=='s' || result[i]=='e' || result[i]=='b' || result[i]=='i' || result[i]=='f' ) {
result.clear();
}
}
}
if( m==DRA_c ) {
for( unsigned int i=0; i<4; i++) {
if( result[i]=='b' || result[i]=='i' || result[i]=='f' ) {
result.clear();
}
}
}
// if( m==DRA ) { // nothing to be done
// }
if( m==DRA_fp ) {
if( lineA.IsParallelTo( lineB )) {
string str;
for( int i=0; i<result.size();i++ ) {
str += result[i];
if( str=="sese" || str=="ffbb" || str=="efbs" || str=="ifbi" ||
str=="bfii" || str=="sfsi" || str=="beie" || str=="bbff" ||
str=="bsef" || str=="biif" || str=="iibf" || str=="sisf" ||
str=="iebe" || str=="rrll" || str=="llrr" ) {
result.push_back( 'P' ); // Allen cases
}
if( str=="eses" || str=="ffff" || str=="fefe" || str=="fifi" ||
str=="fbii" || str=="fsei" || str=="ebis" || str=="iifb" ||
str=="eifs" || str=="iseb" || str=="bbbb" || str=="sbsb" ||
str=="ibib" || str=="rrrr" || str=="llll") {
result.push_back( 'A' ); // Converse Allen cases
}
}
} else {
// Point ptCut;
// if( lineA.IsParallelTo( lineB )) {
// // now is the question if A or P
// if( lineA == lineB ) {
// string str;
// for( int i=0; i<result.size();i++ ) {
// str += result[i];
// }
// result.push_back( '*' );
// } else {
// Line lineX( ptStartA, ptStartB);
// Line lineY( ptEndA, ptEndB);
// if( lineX.GetCut( lineY, ptCut ) <= 0 ) { // no cut => P
// result.push_back( 'A' );
// } else {
// result.push_back( 'P' );
// }
// }
// } else {
// // calculate mathematical orientation
// if( lineB.GetAngle()-lineA.GetAngle() > 0 ) {
// result.push_back( '-' );
// } else { // lineB.GetAngle()-lineA.GetAngle() < 0
// result.push_back( '+' );
// }
// }
// Shift all points by -sA
Point ptOrigin( 0,0);
//cout << "Line A: " << ptStartA << ptEndA << " & Line B: " << ptStartB << ptEndB << endl;
ptEndA.Shift( ptOrigin - ptStartA );
ptStartB.Shift( ptOrigin - ptStartA );
ptEndB.Shift( ptOrigin - ptStartA );
ptStartA.Shift( ptOrigin - ptStartA );
//cout << "Line A: " << ptStartA << ptEndA << " & Line B: " << ptStartB << ptEndB << endl;
// Rotate all points by -phi(eA)
float angle = ptStartA.GetAngleTo( ptEndA );
ptStartA.Rotate( -angle );
ptEndA.Rotate( -angle );
ptStartB.Rotate( -angle );
ptEndB.Rotate( -angle );
//cout << "Line A: " << ptStartA << ptEndA << " & Line B: " << ptStartB << ptEndB << endl;
// Shift eB by -sB
ptEndB.Shift( ptOrigin - ptStartB );
ptStartB.Shift( ptOrigin - ptStartB );
//cout << "Line A: " << ptStartA << ptEndA << " & Line B: " << ptStartB << ptEndB << endl;
// if(ptEndB.Y()>-0.0001 && ptEndB.Y()<0.0001) {
// // lines are parallel => A or P (epsilon due to shift/rotate errors)
// if( ptEndB.X()>0 ) {
// result.push_back( 'P' );
// } else if( ptEndB.X()<0 ) {
// result.push_back( 'A' );
// } else {
// result.push_back( '*' );
// }
// } else
if(ptEndB.Y()>0) {
result.push_back( '+' );
} else if(ptEndB.Y()<0) {
result.push_back( '-' );
}
}
}
return result;
}