martin@0: #include martin@0: #include "Decoder.h" martin@0: #include martin@0: using namespace std; martin@0: martin@0: int main (int argc, char * const argv[]) { martin@0: string answer; martin@0: int test_choice; martin@0: martin@0: do{ martin@0: martin@0: double azimuth, elevation; martin@0: Decoder myDecoder; martin@0: martin@0: martin@0: martin@0: cout << "Provide Azimuth then Elevation\n"; martin@0: cin >> azimuth >> elevation; martin@0: martin@0: double w_in = 1/sqrt(2); martin@0: double x_in = cos(myDecoder.degRad(azimuth)) * cos(myDecoder.degRad(elevation)); martin@0: double y_in = sin(myDecoder.degRad(azimuth)) * cos(myDecoder.degRad(elevation)); martin@0: double z_in = sin(myDecoder.degRad(elevation)); martin@0: martin@0: martin@0: cout << endl << "w_in = " << w_in << endl; martin@0: cout << "x_in = " << x_in << endl; martin@0: cout << "y_in = " << y_in << endl; martin@0: cout << "z_in = " << z_in << endl << endl; martin@0: martin@0: cout << "Selection\n 1=Rotation\n 2=Tilt\n 3=Tumble\n 4=Dominance\n 5=Press\n 6=Push\n 7=Focus\n 8=xyDecode\n 9=msDecode\n"; martin@0: cin >> test_choice; martin@0: martin@0: martin@0: switch (test_choice) { martin@0: case 1: martin@0: //Test Rotation martin@0: cout << "Enter rotation in degrees:\n"; martin@0: cin >> myDecoder.Rotate; martin@0: myDecoder.rotateField(x_in, y_in); martin@0: break; martin@0: case 2: martin@0: //Test Tilt martin@0: cout << "Enter tilt in degrees:\n"; martin@0: cin >> myDecoder.Tilt; martin@0: myDecoder.tiltField(y_in, z_in); martin@0: break; martin@0: case 3: martin@0: //Test Tumble martin@0: cout << "Enter tumble in degrees:\n"; martin@0: cin >> myDecoder.Tumble; martin@0: myDecoder.tumbleField(x_in, z_in); martin@0: break; martin@0: case 4: martin@0: //Test Tumble martin@0: cout << "Enter Zoom factor, -100 to 100:\n"; martin@0: cin >> myDecoder.Zoom; martin@0: myDecoder.dominanceZoom(w_in, x_in, y_in, z_in); martin@0: break; martin@0: case 5: martin@0: //Test Press martin@0: cout << "Enter Zoom factor, -100 to 100:\n"; martin@0: cin >> myDecoder.Zoom; martin@0: myDecoder.pressZoom(w_in, x_in, y_in, z_in); martin@0: break; martin@0: case 6: martin@0: //Test Push martin@0: cout << "Enter Zoom factor, -100 to 100:\n"; martin@0: cin >> myDecoder.Zoom; martin@0: myDecoder.pushZoom(w_in, x_in, y_in, z_in); martin@0: break; martin@0: case 7: martin@0: //Test Focus martin@0: cout << "Enter Zoom factor, -100 to 100:\n"; martin@0: cin >> myDecoder.Zoom; martin@0: myDecoder.focusZoom(w_in, x_in, y_in, z_in); martin@0: break; martin@0: case 8: martin@0: //Stereo Decode XY martin@0: cout << "Enter Width and Pattern\n"; martin@0: cin >> myDecoder.Width >> myDecoder.Pattern; martin@0: myDecoder.xyDecode(w_in, x_in, y_in, z_in); martin@0: break; martin@0: case 9: martin@0: //Stereo Decode MS martin@0: cout << "Enter Width and Pattern\n"; martin@0: cin >> myDecoder.Width >> myDecoder.Pattern; martin@0: myDecoder.msDecode(w_in, x_in, y_in, z_in); martin@0: break; martin@0: martin@0: martin@0: martin@0: martin@0: default: martin@0: break; martin@0: } martin@0: martin@0: martin@0: martin@0: martin@0: martin@0: martin@0: cout << endl << "w new = " << w_in << endl; martin@0: cout << "x new = " << x_in << endl; martin@0: cout << "y new = " << y_in << endl; martin@0: cout << "z new = " << z_in << endl; martin@0: martin@0: martin@0: double azimuth_out = atan2(y_in, x_in); martin@0: double elevation_out = atan2(z_in, sqrt(pow(x_in,2) + pow(y_in,2))); martin@0: cout << endl << "Calculate azimuth = " << myDecoder.radDeg(azimuth_out) <> answer; martin@0: cout << endl; martin@0: } while(answer == "y"); martin@0: martin@0: return 0; martin@0: }