java - How to find an angle from 2 points? -
java - How to find an angle from 2 points? -
i have method in java program:
public static float findangle(float x1, float y1, float x2, float y2) { float deltax = math.abs(x1 - x2); float deltay = math.abs(y1 - y2); homecoming (float)(math.atan2(deltay, deltax) * 180 / math.pi); }
i got googling issue. however, when set practice, splits 1-180, , after 180 goes 1. how prepare this?
don't phone call math.abs
. negative numbers , positive numbers give different results, want preserve sign of deltax
, deltay
.
java math
Comments
Post a Comment