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

Bug 482121

Summary: NPE in Straight#getProjection()
Product: [Tools] GEF Reporter: Alexander Nyßen <nyssen>
Component: GEF GeometryAssignee: Alexander Nyßen <nyssen>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 0.2.0   
Target Milestone: 4.0.0 / 3.11.0 (Neon) M4   
Hardware: All   
OS: All   
Whiteboard:

Description Alexander Nyßen CLA 2015-11-13 10:04:47 EST
While zooming within Zest.FX, an NPE within Straight#getDistance(Straight.java:292) can be observed. It happens because Straight#getIntersection() return null in this case (which should not be the case). The related input data is as follows:

POSITION: Vector: [57.36146803551614,1.8866002881313908E16]
DIRECTION: Vector: [0.0,16.0]
VECTOR: Vector: [51.15375383435782,1.8866002881313916E16]
Comment 1 Alexander Nyßen CLA 2015-11-15 07:27:48 EST
When the position vector of the straight and/or the given vector have very large values when computing Straight#getProjection, the underlying intersection computation performed via Straight#getIntersection() will fail. 

This is because the projective geometry calculation adds position to direction values (this.position.getAdded(this.direction) and other.position.getAdded(other.direction)) is below the precision boundary (i.e. the summation vector will be equal to position or other.position respectively). 

Added a compensation within Straight#getProjection() so that the straight and given vector are virtually shiftet (so that the straight goes through the origin) before the intersection compensation (and the result is shifted back).

Pushed changes to origin/master. Resolving as fixed in 3.11.0 M4.