Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misleading documentation for LocationIndexedLine #937

Open
FObermaier opened this issue Nov 23, 2022 · 0 comments
Open

Misleading documentation for LocationIndexedLine #937

FObermaier opened this issue Nov 23, 2022 · 0 comments

Comments

@FObermaier
Copy link
Contributor

A user of NetTopologySuite reported that there is some misleading documentation for LocationIndexedLine.project and LocationIndexedLine.indexOf. Both state to do only almost similar things while they exactly the same thing:

/**
* Computes the minimum index for a point on the line.
* If the line is not simple (i.e. loops back on itself)
* a single point may have more than one possible index.
* In this case, the smallest index is returned.
*
* The supplied point does not <i>necessarily</i> have to lie precisely
* on the line, but if it is far from the line the accuracy and
* performance of this function is not guaranteed.
* Use {@link #project} to compute a guaranteed result for points
* which may be far from the line.
*
* @param pt a point on the line
* @return the minimum index of the point
*
* @see #project(Coordinate)
*/
public double indexOf(Coordinate pt)
{
return LengthIndexOfPoint.indexOf(linearGeom, pt);
}

/**
* Computes the index for the closest point on the line to the given point.
* If more than one point has the closest distance the first one along the line
* is returned.
* (The point does not necessarily have to lie precisely on the line.)
*
* @param pt a point on the line
* @return the index of the point
*/
public double project(Coordinate pt)
{
return LengthIndexOfPoint.indexOf(linearGeom, pt);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant