Ejemplo n.º 1
0
// =================================================================================
// 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;
}
Ejemplo n.º 2
0
/*****************************************************************************
*** 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";
    //     }
    //     // Angle (2./3. letter)
    //     CAngle angle = -ptOrigin.GetAngleTo( ptRelatum );
    //     ptReferent.Rotate( angle.get(), ptRelatum );
    //     int iSegmentNo = ptRelatum.GetAngleTo( ptReferent ) ;

    return sResult;
}