//printf(" Box Area (%i) = %i \n",n,myBoxArea[n]); // Print the area (size) of the box.
//printf(" Box Centre (x,%i) = %i \n",n,myBoxCentreX[n]); // Print the box centre (x) coordinate.
//printf(" Box Centre (y,%i) = %i \n",n,myBoxCentreY[n]); // Print the box centre (y) coordinate.
// Divide up into 'Nonants' (the 9 version of quadrants). // 1200/3 = 400, 720/3 = 240.
// Or divide into sextants eg 1920/3 = 640:
if (( myBoxCentreX[n] <= 640 ) && ( myBoxCentreY[n] <= 540 ))
{
nonant = 0;
nonantDevianceX[0] = myBoxCentreX[n] -320;
nonantDevianceY[0] = myBoxCentreY[n] -270;
//printf(" Nonant (%i) = %i \n",n,nonant);
}
if (( myBoxCentreX[n] >= 641 ) && ( myBoxCentreX[n] <= 1280 ) && ( myBoxCentreY[n] <= 540 ))
{
nonant = 1;
nonantDevianceX[1] = myBoxCentreX[n] -960;
nonantDevianceY[1] = myBoxCentreY[n] -270;
//printf(" Nonant (%i) = %i \n",n,nonant);
}
if (( myBoxCentreX[n] >= 1281 ) && ( myBoxCentreY[n] <= 540 ))
{
nonant = 2;
nonantDevianceX[2] = myBoxCentreX[n] -1600;
nonantDevianceY[2] = myBoxCentreY[n] -270;
//printf(" Nonant (%i) = %i \n",n,nonant);
}
if (( myBoxCentreX[n] <= 640 ) && ( myBoxCentreY[n] >= 541 ))
{
nonant = 3;
nonantDevianceX[3] = myBoxCentreX[n] -320;
nonantDevianceY[3] = myBoxCentreY[n] -810;
//printf(" Nonant (%i) = %i \n",n,nonant);
}
if (( myBoxCentreX[n] >= 641 ) && ( myBoxCentreX[n] <= 1281 ) && ( myBoxCentreY[n] >= 541 ))
{
nonant = 4;
nonantDevianceX[4] = myBoxCentreX[n] -960;
nonantDevianceY[4] = myBoxCentreY[n] -810;
//printf(" Nonant (%i) = %i \n",n,nonant);
}
if (( myBoxCentreX[n] >= 1281 ) && ( myBoxCentreY[n] >= 541 ))
{
nonant = 5;
nonantDevianceX[5] = myBoxCentreX[n] -1600;
nonantDevianceY[5] = myBoxCentreY[n] -810;
//printf(" Nonant (%i) = %i \n",n,nonant);
}
//printf(" Nonant (%i) = %i \n",n,nonant);
//printf("..................................................... \n");
//I2CDataHandler();
}
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.