Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 373479

Summary: Vector.getAngle(Vector) sometimes returns "Nan" instead of "180"
Product: [Tools] GEF Reporter: Ivan Lelekov <ivanl_builds>
Component: GEF-Legacy Draw2dAssignee: Alexander Nyßen <nyssen>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: nyssen
Version: 3.7.1   
Target Milestone: 3.8.0 (Juno)   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Ivan Lelekov CLA 2012-03-07 03:56:22 EST
Next pease of code Outputs "Nan" instead of "180"

  Vector a = new Vector( 24.03809869102058,-6.868028197434448);
  Vector b = new Vector(-24.038098691020593,6.868028197434448);
  System.out.println(a.getAngle(b));
Comment 1 Alexander Nyßen CLA 2012-03-11 12:32:45 EDT
This was caused by rounding effects. Changed implementation to handle values outside the [-1, 1] range. Resolving as fixed in 3.8M6.