FACT++  1.0
void BasicGlCamera::calculatePixelsCoords ( )
protected

Definition at line 947 of file BasicGlCamera.cc.

References hexRadius, i, MAX_NUM_PIXELS, neighbors, pixelsCoords, skipPixels(), and updateNeighbors().

Referenced by assignPixelMap(), and BasicGlCamera().

948  {
949  if (pixelsCoords[0][1] >= (0.299999-hexRadius) && pixelsCoords[0][1] <= (0.300001-hexRadius))
950  return;
951  pixelsCoords[0][0] = 0;
952  pixelsCoords[0][1] = 0.3 - hexRadius;
953  pixelsCoords[0][2] = 0;
954  pixelsCoords[1][0] = 0;
955  pixelsCoords[1][1] = 0.3+hexRadius;
956  pixelsCoords[1][2] = 0;
957  neighbors[0][0] = 1;
958  neighbors[1][3] = 0;
959  //from which side of the previous hexagon are we coming from ?
960  int fromSide = 3;
961  //to which side are we heading to ?
962  int toSide = 0;
963  for (int i=2;i<MAX_NUM_PIXELS;i++)
964  {
965  toSide = fromSide-1;
966  if (toSide < 0)
967  toSide =5;
968  while (neighbors[i-1][toSide] >= 0)
969  {
970  toSide--;
971  if (toSide < 0)
972  toSide = 5;
973  }
974  fromSide = toSide + 3;
975  if (fromSide > 5)
976  fromSide -= 6;
977  //ok. now we now in which direction we're heading
978  pixelsCoords[i][0] = pixelsCoords[i-1][0];
979  pixelsCoords[i][1] = pixelsCoords[i-1][1];
980  pixelsCoords[i][2] = pixelsCoords[i-1][2];
981  switch (toSide)
982  {
983  case 0:
984  pixelsCoords[i][1] += 2*hexRadius;
985  break;
986  case 1:
987  pixelsCoords[i][0] += (2*hexRadius)*sin(M_PI/3.0);
988  pixelsCoords[i][1] += (2*hexRadius)*cos(M_PI/3.0);
989  break;
990  case 2:
991  pixelsCoords[i][0] += (2*hexRadius)*sin(M_PI/3.0);
992  pixelsCoords[i][1] -= (2*hexRadius)*cos(M_PI/3.0);
993  break;
994  case 3:
995  pixelsCoords[i][1] -= 2*hexRadius;
996  break;
997  case 4:
998  pixelsCoords[i][0] -= (2*hexRadius)*sin(M_PI/3.0);
999  pixelsCoords[i][1] -= (2*hexRadius)*cos(M_PI/3.0);
1000  break;
1001  case 5:
1002  pixelsCoords[i][0] -= (2*hexRadius)*sin(M_PI/3.0);
1003  pixelsCoords[i][1] += (2*hexRadius)*cos(M_PI/3.0);
1004  break;
1005  };
1006 // pixelsCoords[i][1] -= hexRadius;
1007 
1008  updateNeighbors(i);
1009  }
1010  //Ok. So now we've circled around all the way to MAX_NUM_PIXELS
1011  //do the required shifts so that it matches the fact camera up to ACTUAL_NUM_PIXELS pixels
1012  //remember the location pixels 1438 and 1439, and re-assign them later on
1013  GLfloat backupCoords[4];
1014  skipPixels(1200, 1);
1015  skipPixels(1218, 3);
1016  skipPixels(1236, 1);
1017  skipPixels(1256, 1);
1018  skipPixels(1274, 3);
1019  skipPixels(1292, 3);
1020  skipPixels(1309, 6);
1021  skipPixels(1323, 7);
1022  skipPixels(1337, 6);
1023  skipPixels(1354, 6);
1024  skipPixels(1368, 7);
1025  //la c'est dans 1390 qu'il y a 1439
1026  backupCoords[0] = pixelsCoords[1390][0];
1027  backupCoords[1] = pixelsCoords[1390][1];
1028  skipPixels(1382, 9);
1029  skipPixels(1394, 12);
1030  skipPixels(1402, 15);
1031  skipPixels(1410, 12);
1032  //la c'est dans 1422 qu'il y a 1438
1033  backupCoords[2] = pixelsCoords[1422][0];
1034  backupCoords[3] = pixelsCoords[1422][1];
1035  skipPixels(1422, 12);
1036  skipPixels(1430, 15);
1037 
1038  pixelsCoords[1438][0] = backupCoords[2];
1039  pixelsCoords[1438][1] = backupCoords[3];
1040  pixelsCoords[1439][0] = backupCoords[0];
1041  pixelsCoords[1439][1] = backupCoords[1];
1042  }
int i
Definition: db_dim_client.c:21
static PixelsNeighbors neighbors[MAX_NUM_PIXELS]
#define MAX_NUM_PIXELS
Definition: BasicGlCamera.h:8
void updateNeighbors(int currentPixel)
static GLfloat pixelsCoords[MAX_NUM_PIXELS][3]
void skipPixels(int start, int howMany)

+ Here is the call graph for this function:

+ Here is the caller graph for this function: