当前位置: 首页>>代码示例>>C++>>正文


C++ Point::GetDistanceTo方法代码示例

本文整理汇总了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;
}
开发者ID:dwolter,项目名称:SparQ,代码行数:17,代码来源:gpcc.cpp

示例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";
//.........这里部分代码省略.........
开发者ID:dwolter,项目名称:SparQ,代码行数:101,代码来源:qualifier.cpp


注:本文中的Point::GetDistanceTo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。