Esempio n. 1
0
        public FixedPointVector2 Rotate(FixedPoint angle)
        {
            unchecked {
                FixedPoint cos = angle.Cos();
                FixedPoint sin = angle.Sin();

                return(new FixedPointVector2(X * cos - Y * sin, X * sin + Y * cos));
            }
        }
Esempio n. 2
0
File: Utils.cs Progetto: N-01/UFO
        public static FixedPointVector3 RotatePoint(FixedPointVector3 p, FixedPointVector3 o, FixedPoint angle)
        {
            FixedPointVector3 r = new FixedPointVector3(p.X - o.X, p.Y - o.Y, 0);
            FixedPoint        s = angle.Sin();
            FixedPoint        c = angle.Cos();

            r.X = r.X * c - r.Y * s;
            r.Y = r.Y * c + r.X * s;

            r.X += o.X;
            r.Y += o.Y;

            return(r);
        }