All pastes #638973 Raw Edit

Someone

public text v1 · immutable
#638973 ·published 2007-07-30 08:02 UTC
rendered paste body
#include <iostream>
#include <cmath>
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
using namespace std;

int main(int argc, char* argv[])
{
        float xpos = -1300.0f;
        float ypos = -1300.0f;

        float xbpos = -1301.0f;
        float ybpos = -1302.0f;


        float dx = xpos - xbpos;
        float dy = ypos - ybpos;
        float ang = atan2(dy, dx);
        ang = (ang >= 0) ? ang : 2 * M_PI + ang;
        cout << "Angle:" << ang << endl;
        cout << "Sin: " << sin(ang) << endl;
        cout << "Cos: " << cos(ang) << endl;             
}