コード例 #1
0
 public static FixedPoint GetAngle(Vector2d vec)
 {
     if (vec.y.value == 0)
     {
         return(FixedPoint.N_0);
     }
     return(CustomMath.Atan2((int)(vec.x.value * 10), (int)(vec.y.value * 10)));
 }
コード例 #2
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);
        }
コード例 #3
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));
 }
コード例 #4
0
 public static Vector2d GetVector(int angle)
 {
     return(new Vector2d(CustomMath.Sin(angle), CustomMath.Cos(angle)));
 }