All pastes #432215 Raw Edit

Someone

public java v1 · immutable
·published 2007-04-10 03:21 UTC
rendered paste body
	public static double getLineAngle(Line2D line) {		double angle;		// Calculate the length of the line		double rise = line.getY2() - line.getY1();		double run = line.getX2() - line.getX1();		if(run != 0.0d) {			angle = java.lang.Math.atan(rise/run);		}		else {			// must be either 90 or 270 degrees.			if(rise > 0.00) {				angle = java.lang.Math.toRadians(90);			} else {				angle = java.lang.Math.toRadians(270);			}		}		// Convert the angle to the correct quadrant		if(line.getX2() < line.getX1()) {			// Point B is in the 3rd or 4th quadrant			angle += java.lang.Math.toRadians(180);		}		System.out.println("--------angle: " + angle);		return angle;	}