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

Bug 491405

Summary: Line.getDirectionCCW() is incorrect
Product: [Tools] GEF Reporter: Colin Sharples <ctg>
Component: GEF GeometryAssignee: Alexander Nyßen <nyssen>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: nyssen
Version: 0.2.0   
Target Milestone: 4.0.0 (Neon) M7   
Hardware: PC   
OS: Windows NT   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=460754
Whiteboard:
Attachments:
Description Flags
Patch for Line.getDirectionCCW() nyssen: iplog+

Description Colin Sharples CLA 2016-04-10 20:51:29 EDT
Created attachment 260835 [details]
Patch for Line.getDirectionCCW()

I submitted some enhancements for org.eclipse.gef4.geometry.planar.Line (#460754) some time ago. Unfortunately there was a typo in the getDirectionCCW() method.

	public Angle getDirectionCCW() {
		Point start = getP1();
		Point end = getP2();
		return Angle.fromRad(Math.atan2(end.y - start.y, end.x - start.y));
	}

The second parameter to Math.atan2() should be: end.x - start.x

Patch attached.

This contribution complies to the Eclipse Foundation Certificate of Origin.
Comment 1 Alexander Nyßen CLA 2016-04-11 08:27:25 EDT
Thanks Colin, I released your patch to origin/master. Resolving as fixed in 4.0.0 M7.