Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 313731 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/draw2d/geometry/Geometry.java (-7 / +7 lines)
Lines 157-169 Link Here
157
		 * Calculating square distance from specified point to this segment
157
		 * Calculating square distance from specified point to this segment
158
		 * using formula for Dot product of two vectors.
158
		 * using formula for Dot product of two vectors.
159
		 */
159
		 */
160
		int v1x = x2 - x1;
160
		long v1x = x2 - x1;
161
		int v1y = y2 - y1;
161
		long v1y = y2 - y1;
162
		int v2x = px - x1;
162
		long v2x = px - x1;
163
		int v2y = py - y1;
163
		long v2y = py - y1;
164
		int numerator = v2x * v1y - v1x * v2y;
164
		long numerator = v2x * v1y - v1x * v2y;
165
		int denominator = v1x * v1x + v1y * v1y;
165
		long denominator = v1x * v1x + v1y * v1y;
166
		int squareDistance = (int) ((long) numerator * numerator / denominator);
166
		long squareDistance = numerator * numerator / denominator;
167
		return squareDistance <= tolerance * tolerance;
167
		return squareDistance <= tolerance * tolerance;
168
	}
168
	}
169
169

Return to bug 313731