float SC_GetAngleVector(TGfxVec2 Direction) { float hypothenuse = Direction.Length(); float fAngle = GfxMathRadToDeg(acos(Direction.x / hypothenuse)); if (Direction.y > 0) return -fAngle; return fAngle; }
float SC_GetAngleVector(TGfxVec2 & Position, TGfxVec2 Direction) { TGfxVec2 Vecteur(Direction - Position); float hypothenuse = Vecteur.Length(); float fAngle = GfxMathRadToDeg(acos(Vecteur.x / hypothenuse)); if (Vecteur.y > 0) return -fAngle; return fAngle; }
TColor TColor::ShiftHue(const float fDeg) { float fHueAngle = GfxMathRadToDeg(atan2(sqrt(3.0f) * (g - b), 2 * r - g - b)); if (fHueAngle < 0.0f)fHueAngle += 360.0f; TColor tTemp = TColor::Hue(fHueAngle + fDeg); float fMin = (r < g) ? r : g; fMin = (fMin < b) ? fMin : b; float fMax = (r > g) ? r : g; fMax = (fMax > b) ? fMax : b; tTemp.r = tTemp.r * (fMax - fMin) + fMin; tTemp.g = tTemp.g * (fMax - fMin) + fMin; tTemp.b = tTemp.b * (fMax - fMin) + fMin; //tTemp.a = tTemp.a * (fMax - fMin) + fMin; return tTemp; }
EDirection SC_GetDirectionVector(TGfxVec2 & Position, TGfxVec2 Direction) { TGfxVec2 Vecteur(Direction - Position); float hypothenuse = Vecteur.Length(); float fAngle = GfxMathRadToDeg(acos(Vecteur.x / hypothenuse)); if (Vecteur.y > 0) fAngle *= -1; if (fAngle > -45.0f && fAngle < 45.0f) return EDirection_Right; else if (fAngle > 45.0f && fAngle < 135.0f) return EDirection_Up; else if (fAngle < -45.0f && fAngle > -135.0f) return EDirection_Down; else if (fAngle < -135.0f && fAngle > 45.0f) return EDirection_Left; else return EDirection_Left; }