void SlugsPadCameraControl::getDeltaPositionPad(int x2, int y2) { QPointF localMeasures = ObtenerMarcacionDistanciaPixel(y1,x1,y2,x2); if(localMeasures.y()>10) { QString dir = "nd"; double bearing = localMeasures.x(); bearing = bearing +90; if(bearing>= 360) { bearing = bearing - 360; } if(bearing >337.5 || bearing <=22.5) { motion= UP; movePad = QPoint(0, 1); dir = "UP"; } else if(bearing >22.5 && bearing <=67.5) { motion= RIGHT_UP; movePad = QPoint(1, 1); dir = "RIGHT UP"; } else if(bearing >67.5 && bearing <=112.5) { motion= RIGHT; movePad = QPoint(1, 0); dir = "RIGHT"; } else if(bearing >112.5 && bearing <= 157.5) { motion= RIGHT_DOWN; movePad = QPoint(1, -1); dir = "RIGHT DOWN"; } else if(bearing >157.5 && bearing <=202.5) { motion= DOWN; movePad = QPoint(0, -1); dir = "DOWN"; } else if(bearing >202.5 && bearing <=247.5) { motion= LEFT_DOWN; movePad = QPoint(-1, -1); dir = "LEFT DOWN"; } else if(bearing >247.5 && bearing <=292.5) { motion= LEFT; movePad = QPoint(-1, 0); dir = "LEFT"; } else if(bearing >292.5 && bearing <=337.5) { motion= LEFT_UP; movePad = QPoint(-1, 1); dir = "LEFT UP"; } emit changeMotionCamera(motion); ui->lbPixel->setText(QString::number(localMeasures.y())); ui->lbDirection->setText(dir); //qDebug()<<dir; update(); } }
void SlugsPadCameraControl::getDeltaPositionPad(int x2, int y2) { QString dir = "nd"; QPointF localMeasures = ObtenerMarcacionDistanciaPixel(y1,x1,y2,x2); double bearing = localMeasures.x(); double dist = getDistPixel(y1,x1,y2,x2); if(((bearing > 330)&&(bearing < 360)) || ((bearing >= 0)&&(bearing <= 30))) { emit dirCursorText("up"); //bearing = 315; dir = "up"; } else { if((bearing > 30)&&(bearing <= 60) ) { emit dirCursorText("right up"); //bearing = 315; dir = "right up"; } else { if((bearing > 60)&&(bearing <= 105) ) { emit dirCursorText("right"); //bearing = 315; dir = "right"; } else { if((bearing > 105)&&(bearing <= 150) ) { emit dirCursorText("right down"); //bearing = 315; dir = "right down"; } else { if((bearing > 150)&&(bearing <= 195) ) { emit dirCursorText("down"); //bearing = 315; dir = "down"; } else { if((bearing > 195)&&(bearing <= 240) ) { emit dirCursorText("left down"); //bearing = 315; dir = "left down"; } else { if((bearing > 240)&&(bearing <= 300) ) { emit dirCursorText("left"); //bearing = 315; dir = "left"; } else { if((bearing > 300)&&(bearing <= 330) ) { emit dirCursorText("left up"); //bearing = 315; dir = "left up"; } } } } } } } } bearingPad = bearing; distancePad = dist; directionPad = dir; emit changeCursorPosition(bearing, dist, dir); update(); }