Geometry: Added along attribute to distanceToSegment() function
This commit is contained in:
@@ -441,7 +441,8 @@ OpenLayers.Geometry.segmentsIntersect = function(seg1, seg2, options) {
|
||||
* {Object} An object with distance, x, and y properties. The distance
|
||||
* will be the shortest distance between the input point and segment.
|
||||
* The x and y properties represent the coordinates along the segment
|
||||
* where the shortest distance meets the segment.
|
||||
* where the shortest distance meets the segment. The along attribute
|
||||
* describes how far between the two segment points the given point is.
|
||||
*/
|
||||
OpenLayers.Geometry.distanceToSegment = function(point, segment) {
|
||||
var x0 = point.x;
|
||||
@@ -467,6 +468,7 @@ OpenLayers.Geometry.distanceToSegment = function(point, segment) {
|
||||
}
|
||||
return {
|
||||
distance: Math.sqrt(Math.pow(x - x0, 2) + Math.pow(y - y0, 2)),
|
||||
x: x, y: y
|
||||
x: x, y: y,
|
||||
along: along
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user