Ejemplo n.º 1
0
        public static PointF RotatePoint(PointF pt, PointF center, double ang)
        {
            double prevAngle     = Math.Atan2(pt.Y - center.Y, pt.X - center.X);
            double newAngle      = prevAngle + ang;
            double distance      = PointOps.Distance(pt, center);
            PointF rotatedOffset = new PointF((float)(Math.Cos(newAngle) * distance), (float)(Math.Sin(newAngle) * distance));

            return(PointOps.Add(center, rotatedOffset));
        }
Ejemplo n.º 2
0
        public static LineF RotateLine(LineF ln, double ang)
        {
            PointF center = PointOps.Mult(PointOps.Add(ln.p1, ln.p2), 0.5f);

            return(RotateLineAroundPoint(ln, center, ang));
        }