Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 3, 2014, 1:50:22 PM (10 years ago)
Author:
landauf
Message:

replaced tabs with spaces. no changes in code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/modules/gametypes/SpaceRaceController.cc

    r9667 r9945  
    464464                currentShape->getBoundingSphere(positionObject,radiusObject);
    465465                Vector3 positionObjectNonBT(positionObject.x(), positionObject.y(), positionObject.z());
    466                                 Vector3 norm_r_CP = cP1ToCP2.crossProduct(centerCP1-positionObjectNonBT);
    467 
    468                                 if(norm_r_CP.length() == 0){
    469                                         Vector3 zufall;
     466                Vector3 norm_r_CP = cP1ToCP2.crossProduct(centerCP1-positionObjectNonBT);
     467
     468                if(norm_r_CP.length() == 0){
     469                    Vector3 zufall;
    470470                    do{
    471471                        zufall=Vector3(rnd(),rnd(),rnd());//random
    472472                    }while((zufall.crossProduct(cP1ToCP2)).length() == 0);
    473                                         norm_r_CP=zufall.crossProduct(cP1ToCP2);
    474                                 }
    475                                 Vector3 VecToVCP = norm_r_CP.crossProduct(cP1ToCP2);
    476                                 float distanzToCP1 = sqrt(powf(radiusObject,4)/(powf((centerCP1-positionObjectNonBT).length(), 2)-powf(radiusObject,2))+powf(radiusObject,2));
    477                                 float distanzToCP2 = sqrt(powf(radiusObject,4)/(powf((racepoint2->getPosition()-positionObjectNonBT).length(), 2)-powf(radiusObject,2))+powf(radiusObject,2));
     473                    norm_r_CP=zufall.crossProduct(cP1ToCP2);
     474                }
     475                Vector3 VecToVCP = norm_r_CP.crossProduct(cP1ToCP2);
     476                float distanzToCP1 = sqrt(powf(radiusObject,4)/(powf((centerCP1-positionObjectNonBT).length(), 2)-powf(radiusObject,2))+powf(radiusObject,2));
     477                float distanzToCP2 = sqrt(powf(radiusObject,4)/(powf((racepoint2->getPosition()-positionObjectNonBT).length(), 2)-powf(radiusObject,2))+powf(radiusObject,2));
    478478                float distanz = std::max(distanzToCP1,distanzToCP2);
    479                                 //float distanz = 0.0f; //TEMPORARY
    480                                 Vector3 newCheckpointPositionPos = positionObjectNonBT+(distanz*VecToVCP)/VecToVCP.length();
    481                                 Vector3 newCheckpointPositionNeg = positionObjectNonBT-(distanz*VecToVCP)/VecToVCP.length();
    482                                 if((newCheckpointPositionPos - centerCP1).length() + (newCheckpointPositionPos - (centerCP1+cP1ToCP2)).length() < (newCheckpointPositionNeg - centerCP1).length() + (newCheckpointPositionNeg - (centerCP1+cP1ToCP2)).length() )
    483                                 {
    484                                         RaceCheckPoint* newVirtualCheckpoint = addVirtualCheckPoint(racepoint1,racepoint2->getCheckpointIndex(), newCheckpointPositionPos);
    485                                 }
    486                                 else
    487                                 {
    488                                         RaceCheckPoint* newVirtualCheckpoint = addVirtualCheckPoint(racepoint1,racepoint2->getCheckpointIndex(), newCheckpointPositionNeg);
    489                                 }
    490                                 return;
     479                //float distanz = 0.0f; //TEMPORARY
     480                Vector3 newCheckpointPositionPos = positionObjectNonBT+(distanz*VecToVCP)/VecToVCP.length();
     481                Vector3 newCheckpointPositionNeg = positionObjectNonBT-(distanz*VecToVCP)/VecToVCP.length();
     482                if((newCheckpointPositionPos - centerCP1).length() + (newCheckpointPositionPos - (centerCP1+cP1ToCP2)).length() < (newCheckpointPositionNeg - centerCP1).length() + (newCheckpointPositionNeg - (centerCP1+cP1ToCP2)).length() )
     483                {
     484                    RaceCheckPoint* newVirtualCheckpoint = addVirtualCheckPoint(racepoint1,racepoint2->getCheckpointIndex(), newCheckpointPositionPos);
     485                }
     486                else
     487                {
     488                    RaceCheckPoint* newVirtualCheckpoint = addVirtualCheckPoint(racepoint1,racepoint2->getCheckpointIndex(), newCheckpointPositionNeg);
     489                }
     490                return;
    491491            }
    492492        }
Note: See TracChangeset for help on using the changeset viewer.