Beispiel #1
0
        public static Line2D lineRotatedBy(Line2D line, double radians)
        {
            double returnX = line.getX2() - line.getX1();
            double returnY = line.getY2() - line.getY1();

            double cosineTheta = Math.cos(radians);
            double sineTheta   = Math.sin(radians);

            Point2D returnPoint = new Point2D.Double(
                (returnX * cosineTheta - returnY * sineTheta),
                (returnX * sineTheta + returnY * cosineTheta)
                );

            return(new Line2D.Double(
                       0,
                       0,
                       returnPoint.getX(),
                       returnPoint.getY()
                       ));
        }