if(x1==0) x1= 127; //Rescale x-axis to be inverted
else{
if(x1>128){ //This if-else reverses the two halves of the x-scale
x1-=128;
/*x1= ~x1; //This code flips the x-axis
x1+=1;*/
}
else{
x1+=128;
/*x1= ~x1; //This code flips the x-axis
x1+=1;*/
}
}
if(y1>128){ //This if-else inverts the y-scale
y1-=128;
/* y1= ~y1; //This code flips the y-axis
y1+=1;*/
}
else{
y1= (y1 ^ 0x80);
/* y1= ~y1; //This code flips the y-axis
y1+=1;*/
}
Listing 1—The number conversion
code transformed our unsigned 0 to 255 range of sampled numbers into a –128 to
127 two’s complement representation.