2 * File written by Raphael Champeimont
3 * UMR 7238 Genomique des Microorganismes
5 package fr.orsay.lri.varna.models.geom;
7 import java.awt.geom.Point2D;
11 * @author Raphael Champeimont
12 * Misc geometry functions.
14 public class MiscGeom {
17 * Compute the angle made by a vector.
19 public static double angleFromVector(Point2D.Double v) {
20 return MiscGeom.angleFromVector(v.x, v.y);
23 public static double angleFromVector(double x, double y) {
24 double l = Math.hypot(x, y);
26 return Math.acos(x / l);
28 return - Math.acos(x / l);
30 return x > 0 ? 0 : Math.PI;