Java Geometry Algorithm generateLine(Point2D.Double point, double length, double angle)

Here you can find the source of generateLine(Point2D.Double point, double length, double angle)

Description

generate Line

License

Apache License

Declaration

public static Line2D.Double generateLine(Point2D.Double point, double length, double angle) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.awt.geom.Line2D;
import java.awt.geom.Point2D;

public class Main {
    public static Line2D.Double generateLine(Point2D.Double point, double length, double angle) {
        double endX = length * Math.cos(angle * (Math.PI / 180)) + point.x;
        double endY = length * Math.sin(angle * (Math.PI / 180)) + point.y;

        return new Line2D.Double(point, new Point2D.Double(endX, endY));
    }/*from w  ww. jav a 2 s  .c  o m*/
}

Related

  1. findIntersection(Point2D.Double p1, Point2D.Double p2, Point2D.Double p3, Point2D.Double p4)
  2. findLineSegmentIntersection(Line2D one, Line2D two, Point2D intersection)
  3. findMiddlePoint(Point2D p1, Point2D p2)
  4. fitCircle(final Point2D P1, final Point2D P2, final Point2D P3)
  5. forceMouseMove(Point pos)
  6. generateLookAtTag(ArrayList geoCoords, ArrayList modsAM)
  7. generatePoint(Shape region)
  8. generateRobotPositions(Point start, Point end, int stepSize)
  9. generateSpline(final Point[] controls)