Draw a line at a specific angle in Java

Is this what you’re looking for?

startX = x;
startY = y;
endX   = x + 40 * Math.sin(angle);
endY   = y + 40 * Math.cos(angle);

And draw a line from (startX, startY) to (endX, endY) in whatever API you’re using.

Also note that angle is in radians. If you had it in degrees, you need to convert it first:

angle = angle * Math.PI / 180;

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)