Exemplo n.º 1
0
        public static Vector2d Rotate(Vector2d vec, int angle)
        {
            Vector2d   last;
            FixedPoint cos = CustomMath.Cos(angle);
            FixedPoint sin = CustomMath.Sin(angle);

            last.x = vec.x * cos + vec.y * sin;
            last.y = vec.x * -sin + vec.y * cos;
            return(last);
        }
Exemplo n.º 2
0
 public FPObb(Vector2d pos, Vector2d size, int angle)
 {
     center = pos;
     e      = size * new FixedPoint(0.5f);
     ang    = angle;
     /// <summary>
     /// 2D环境中的角度,转为世界坐标中的xy方向的向量
     /// </summary>
     u    = new Vector2d[2];
     u[0] = new Vector2d(CustomMath.Cos(angle), -CustomMath.Sin(angle));
     u[1] = new Vector2d(CustomMath.Sin(angle), CustomMath.Cos(angle));
 }
Exemplo n.º 3
0
 public static Vector2d GetVector(int angle)
 {
     return(new Vector2d(CustomMath.Sin(angle), CustomMath.Cos(angle)));
 }