summaryrefslogtreecommitdiff
path: root/2004/i/nono/src/ovision/adjust.cc
diff options
context:
space:
mode:
Diffstat (limited to '2004/i/nono/src/ovision/adjust.cc')
-rw-r--r--2004/i/nono/src/ovision/adjust.cc34
1 files changed, 19 insertions, 15 deletions
diff --git a/2004/i/nono/src/ovision/adjust.cc b/2004/i/nono/src/ovision/adjust.cc
index 3c84def..a58081e 100644
--- a/2004/i/nono/src/ovision/adjust.cc
+++ b/2004/i/nono/src/ovision/adjust.cc
@@ -17,7 +17,10 @@ using namespace std;
int window;
Comm *comm;
-int point[3][2] = {{-1,-1},{-1,-1},{-1,-1}};
+
+#define NB_POINTS_UI 6
+
+int point[NB_POINTS_UI][2] = {{-1,-1},{-1,-1},{-1,-1},{-1,-1},{-1,-1}};
int width=538; int height=395;
int* GetPpoint()
@@ -208,20 +211,21 @@ DrawGLScene()
glColor3ub(0,0,255);
glDisable(GL_TEXTURE_2D);
// Dessine points de calibration de la distance
- for (int i=0; i<3; i++)
+ for (int i=0; i<NB_POINTS_UI; i++)
{
if (point[i][0] >= 0)
/* x = (int)((double)WIDTH/width * x);
y = height - y;
y = (int)((double)HEIGHT/height * y);*/
glBegin(GL_POINTS);
- glVertex3f(point[i][0] * 352 / IMG_WIDTH + BORDER,
- point[i][1] * 288 / IMG_HEIGHT + 3 * BORDER ,
+ glVertex3f( (float)((point[i][0] + BORDER) * (double)352 / IMG_WIDTH),
+ (float)((point[i][1] + BORDER) * (double)288 / IMG_HEIGHT),
+ -0.9f);
+ glVertex3f( (float)((point[i][0] + BORDER) * (double)352 / IMG_WIDTH),
+ (float)((point[i][1] + BORDER) * (double)288 / IMG_HEIGHT + 288 + BORDER),
-0.9f);
glEnd();
- std::cout << point[i][0] * 352 / IMG_WIDTH + BORDER << " " <<
- point[i][1] * 288 / IMG_HEIGHT + 3 * BORDER << endl;
}
glEnable(GL_TEXTURE_2D);
@@ -253,7 +257,6 @@ MouseFunc(int button, int state, int x, int y)
{
// On calcul les coordonnees de l'image
x = (int)((double)WIDTH/width * x);
- y = height - y;
y = (int)((double)HEIGHT/height * y);
int imgX = -1;
int imgY = -1;
@@ -270,43 +273,44 @@ MouseFunc(int button, int state, int x, int y)
imgY = y * IMG_HEIGHT / 288 - 3 * BORDER - 288;
}
+ cout << "x " << imgX << " y " << imgY << endl;
int i=0;
- // cout << "Point ajoute: " << imgX << ", " << imgY << endl;
-
if (imgX >= 0)
{
+ imgY = IMG_HEIGHT - imgY;
+
// Ajout de point
if (button == GLUT_LEFT_BUTTON)
{
- while(i < 3)
+ while(i < NB_POINTS_UI)
{
if (point[i][0] < 0)
{
point[i][0] = imgX;
point[i][1] = imgY;
- i=5;
+ i=NB_POINTS_UI+3;
cout << "Point ajoute: " << imgX << ", " << imgY << endl;
}
i++;
}
- if (i == 5) cout << "MouseFunc : 3 points sont deja selectionnes" << endl;
+ if (i == NB_POINTS_UI+3) cout << "MouseFunc : 3 points sont deja selectionnes" << endl;
}
// Suppression de point
else if (button == GLUT_RIGHT_BUTTON)
{
- while(i<3)
+ while(i<NB_POINTS_UI)
{
if ((abs(point[i][0] - imgX) < 5) && (abs(point[i][1] - imgY) < 5))
{
point[i][0] = -1;
point[i][1] = -1;
- i=5;
+ i=NB_POINTS_UI+3;
}
i++;
}
- if (i == 5) cout << "MouseFunc : 0 point selectionne" << endl;
+ if (i == NB_POINTS_UI+3) cout << "MouseFunc : 0 point selectionne" << endl;
}
}
DrawGLScene();