Here you can find the source of generateLine(Point2D.Double point, double length, double angle)
public static Line2D.Double generateLine(Point2D.Double point, double length, double angle)
//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*/ }