本文整理汇总了C++中Point::GetDistanceTo方法的典型用法代码示例。如果您正苦于以下问题:C++ Point::GetDistanceTo方法的具体用法?C++ Point::GetDistanceTo怎么用?C++ Point::GetDistanceTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point
的用法示例。
在下文中一共展示了Point::GetDistanceTo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: calculateRadii
// =================================================================================
// GET Angle and Distance
// =================================================================================
int GPCC::calculateRadii( Point ptReferent ) {
if( !m_bOriginSet || !m_bRelatumSet) { // insufficient data 4 calc
return false;
}
m_fRadius = m_ptOrigin.GetDistanceTo( m_ptRelatum );
BB_DBG(2) << "Radius (Origin<->Relatum : " << m_fRadius
<< "( " << m_ptOrigin << " | " << m_ptRelatum << " )"
<< endl;
m_fDistRelRef = ptReferent.GetDistanceTo( m_ptRelatum );
BB_DBG(2) << "Radius (Referent<->Relatum : " << m_fDistRelRef
<< "( " << ptReferent << " | " << m_ptRelatum << " )"
<< endl;
return true;
}
示例2: getTPCC_Relation_String
/*****************************************************************************
*** Ternary Point Configuration Calculus (TPCC)
*****************************************************************************/
std::string getTPCC_Relation_String( Point ptOrigin, Point ptRelatum, Point ptReferent) {
std::string sResult;
std::string sDist;
// TPCC is a special case of GPCC
// resolve special cases although handled in GPCC as well
if( ptOrigin==ptRelatum ) {
if( ptOrigin==ptReferent ) {
return "tri";
} else {
return "dou";
}
}
float distBC = ptRelatum.GetDistanceTo( ptReferent );
if ( distBC == 0 ) {
return "sam";
}
GTPCC gtpcc(2, ptRelatum.X(), ptRelatum.Y(), ptOrigin.X() , ptOrigin.Y());
gtpcc.setLinear( true );
// now linear segment boarders (NOT as disjunction of neighboring relations)
// distance = 0,1 or 2 with 1 is close and 2 is distant
// orientation
std::vector< std::vector< int > > vResult = gtpcc.getSectorTupel( ptReferent.X(), ptReferent.Y() );
// close or distant ? (distance ist unique)
if( vResult[0][0]==0 ) {
sDist = "0";
} else if( vResult[0][0]==1 ) {
sDist = "c";
} else {
sDist = "d";
}
// size=1 or 2
if( vResult.size() == 1 ) {
// which angle segment?
switch ( vResult[0][1]-1 ) {
case 0:
sResult = sDist + "sb";
break;
case 1:
sResult = sDist + "lb";
break;
case 2:
sResult = "(" + sDist + "lb" + "," + sDist + "bl" +")";
break;
case 3:
sResult = sDist + "bl";
break;
case 4:
sResult = sDist + "sl";
break;
case 5:
sResult = sDist + "fl";
break;
case 6:
sResult = "(" + sDist + "fl" + "," + sDist + "lf" +")";
break;
case 7:
sResult = sDist + "lf";
break;
case 8:
sResult = sDist + "sf";
break;
case 9:
sResult = sDist + "rf";
break;
case 10:
sResult = "(" + sDist + "rf" + "," + sDist + "fr" +")";
break;
case 11:
sResult = sDist + "fr";
break;
case 12:
sResult = sDist + "sr";
break;
case 13:
sResult = sDist + "br";
break;
case 14:
sResult = "(" + sDist + "br" + "," + sDist + "rb" +")";
break;
case 15:
sResult = sDist + "rb";
break;
default: // ERROR
sResult = sDist + "XX";
break;
}
} else { // if( vResult.size > 1 )
sResult = "???"; // ERROR
}
// float distAB ptOrigin.GetDistanceTo( ptRelatum );
// float rABC = distBC / distAB;
// if( rABC < 1) {
// sResult = "c";
// } else {
// sResult = "d";
//.........这里部分代码省略.........