C++ (Cpp) cos Examples

C++ (Cpp) cos - 30 examples found. These are the top rated real world C++ (Cpp) examples of cos extracted from open source projects. You can rate examples to help us improve the quality of examples.
Example #1
0
// Form ARINC 705 standard {heading/pitch/roll} rotation matrix
// Rotates local<-body
NEWMAT::Matrix rspfAlphaSensor::formHPRmat(const rspf_float64& r,
        const rspf_float64& p,
        const rspf_float64& h)const
{
    rspf_float64 cp = cos(p);
    rspf_float64 sp = sin(p);
    rspf_float64 ch = cos(h);
    rspf_float64 sh = sin(h);
    rspf_float64 cr = cos(r);
    rspf_float64 sr = sin(r);

    NEWMAT::Matrix rollM   = rspfMatrix3x3::create(  1,  0,  0,
                             0, cr,-sr,
                             0, sr, cr);

    NEWMAT::Matrix pitchM  = rspfMatrix3x3::create( cp,  0, sp,
                             0,  1,  0,
                             -sp,  0, cp);

    NEWMAT::Matrix hdgM    = rspfMatrix3x3::create( ch,-sh,  0,
                             sh, ch,  0,
                             0,  0,  1);

    NEWMAT::Matrix body2LocalRot = hdgM * pitchM * rollM;

    return body2LocalRot;
}
Example #2
0
void SimCalcs::rotateZ(int aIdx, Real angleDeg, Real** aCoords) {
    Real angleRad = angleDeg * 3.14159265358979 / 180.0;
    Real oldX = aCoords[X_COORD][aIdx];
    Real oldY = aCoords[Y_COORD][aIdx];
    aCoords[X_COORD][aIdx] = oldX * cos(angleRad) + oldY * sin(angleRad);
    aCoords[Y_COORD][aIdx] = oldY * cos(angleRad) - oldX * sin(angleRad);
}
Example #3
0
int dist(double p1, double t1, double p2, double t2)
{
    double a = cos(p1) * cos(p2) * cos(t1 - t2) + sin(p1) * sin(p2);
    if (a < -1.) a = -1.;
    if (a > 1.) a = 1.;
    return (int)floor(acos(a) * 6378. + 0.5);
}
Example #4
0
void
Camera::processMouseMovementInput(double xpos, double ypos)
{
    double deltaYawAngle = 0.0;
    double deltaPitchAngle = 0.0;
    if (isMouseInitialized)
    {
        deltaYawAngle = (xpos - mouseX) * mouseSensivity;
        deltaPitchAngle = (ypos - mouseY) * mouseSensivity;
    }
    else
    {
        isMouseInitialized = true;
    }
    mouseX = xpos;
    mouseY = ypos;
    yawAngle += deltaYawAngle;
    pitchAngle += deltaPitchAngle;

    glm::vec3 front;
    front.x = cos(glm::radians(pitchAngle)) * cos(glm::radians(yawAngle));
    front.y = sin(glm::radians(pitchAngle));
    front.z = cos(glm::radians(pitchAngle)) * sin(glm::radians(yawAngle));
    cameraFront = glm::normalize(front);
}
Example #5
0
static double blackman(params *p, double x)
{
    double a = p->params[0];
    double a0 = (1-a)/2.0, a1 = 1/2.0, a2 = a/2.0;
    double pix = M_PI * x;
    return a0 + a1*cos(pix) + a2*cos(2 * pix);
}
Example #6
0
/*=============================================================================
 * FOCUS HALO
 */
static void mdFocusHalo(float h, cellC* c)
{
    float s = (self->Focus == c) ? .7 : .3;
    int t = (timeGet() / 50)%1000;

    double step = 2*M_PI/50;
    int r = self->Color->R;
    int g = self->Color->G;
    int b = self->Color->B;

    glEnable(GL_BLEND);
    glEnable(GL_DEPTH_TEST);
    glDisable(GL_TEXTURE_2D);

    glBegin(GL_TRIANGLE_STRIP);
    for(float a = .0; a < 2*M_PI+step; a += step)
    {
        glColor4ub(r,g,b, 20);
        glVertex3f(.2*sin(a), .2*cos(a), h);

        glColor4ub(r,g,b, 255);
        glVertex3f(s*sin(a), s*cos(a), h+.1+.3*sin(M_PI*t/1000));
    }
    glEnd();
}