//------------------------------------------------------------------------------
 bool        TurnShipAboutCondition::Evaluate (void)
 {
     Vector  forward = m_ship->GetOrientation ().GetForward ();
     float   cosTheta = forward * m_startingForward;
     float   minAngleDegrees = 10.0f;
     float   minCosAngle = cosf (RadiansFromDegrees(minAngleDegrees));
     // the ship has "turned about" if the angle of movement is greate than the min angle
     return (cosTheta < minCosAngle) ? true : false;
 }
Ejemplo n.º 2
0
    SolidObject& TriangleMesh::RotateZ(double angleInDegrees)
    {
        const double angleInRadians = RadiansFromDegrees(angleInDegrees);
        const double a = cos(angleInRadians);
        const double b = sin(angleInRadians);
        const Vector center = Center();
        PointList::iterator iter = pointList.begin();
        PointList::iterator end  = pointList.end();
        for (; iter != end; ++iter)
        {
            Vector& point = *iter;
            const double dx = point.x - center.x;
            const double dy = point.y - center.y;
            point.x = center.x + (a*dx - b*dy);
            point.y = center.y + (a*dy + b*dx);
        }

        return *this;
    }