animationsberechnung bei grossen steps beschleunigt, usw.

git-svn-id: http://svn.lsim.tuxzone.org/trunk@13 4bec179b-ab65-46ed-a5f8-55b8b5c735d0
This commit is contained in:
catdog2
2008-11-12 21:50:47 +00:00
parent 9730481953
commit 75632cdbbc
7 changed files with 340 additions and 40 deletions

View File

@@ -94,12 +94,16 @@ void GraphicsEllipseItem::calculateProbePath(QPointF startPoint) {
//startpunkt in den Pfad setzen
flightPath = QPainterPath(startPoint);
int debugTime = 0;
time_t start_time = time(0);
for(int i = 1; i< steps;++i) {
double myMasse = getMasse( sqrt( speedListX->at(i-1)*speedListX->at(i-1) + speedListY->at(i-1)*speedListY->at(i-1) ) );
//qDebug()<< myMasse;
time_t timeb = time(0);
double powerX = myScene->getPowerAt(currProbePath->at(i-1), charge, speedListX->at(i-1),speedListY->at(i-1), 'x');
double powerY = myScene->getPowerAt(currProbePath->at(i-1), charge, speedListX->at(i-1),speedListY->at(i-1), 'y');
time_t timea = time(0);
debugTime += difftime(timea,timeb);
double newspeedX = speedListX->at(i-1) + (powerX/myMasse * (timePerStep/1000.0));
double newspeedY = speedListY->at(i-1) + (powerY/myMasse * (timePerStep/1000.0));
@@ -121,15 +125,17 @@ void GraphicsEllipseItem::calculateProbePath(QPointF startPoint) {
currProbePath->append(newPoint);
speedListX->append(newspeedX);
speedListY->append(newspeedY);
/*if(i%10 == 0)*/ flightPath.lineTo(newPoint);
flightPath.lineTo(newPoint);
}
qDebug()<< difftime(time(0),start_time);
qDebug()<< debugTime;
qDebug()<< "Probe Path: " <<*currProbePath;
qDebug()<< "speed x: "<<*speedListX;
qDebug()<< "speed y: "<<*speedListY;
qDebug()<<speedListY->at(12);
//qDebug()<< "Probe Path: " <<*currProbePath;
//qDebug()<< "speed x: "<<*speedListX;
//qDebug()<< "speed y: "<<*speedListY;
//qDebug()<<speedListY->at(12);
//qDebug()<<"power x: "<< (double)myScene->getPowerAt(QPointF(0,0), charge, 'x');
//qDebug()<<"power y: " << (double)myScene->getPowerAt(QPointF(0,0), charge, 'y');
@@ -137,7 +143,7 @@ void GraphicsEllipseItem::calculateProbePath(QPointF startPoint) {
double GraphicsEllipseItem::getMasse(double speed) {
if(speed == 0) return masse;
if(speed < SPEED_OF_LIGHT/10.0) return masse;
else {
return masse / (sqrt(1- ( (speed/SPEED_OF_LIGHT)*(speed/SPEED_OF_LIGHT))));