Package org.djutils.draw.line
Interface Project<P extends Point<P>>
-
- Type Parameters:
P
- the point type (2d or 3d)
- All Known Subinterfaces:
LineSegment<P,R>
,PolyLine<L,P,R,LS>
,Ray<R,P>
- All Known Implementing Classes:
LineSegment2d
,LineSegment3d
,Polygon2d
,Polygon3d
,PolyLine2d
,PolyLine3d
,Ray2d
,Ray3d
public interface Project<P extends Point<P>>
Project.java.Copyright (c) 2021-2023 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See DJUTILS License.- Author:
- Alexander Verbraeck, Peter Knoppers
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description P
projectOrthogonal(P point)
Project a point onto this object.P
projectOrthogonalExtended(P point)
Project a point onto this object.double
projectOrthogonalFractional(P point)
Project a point onto this object.double
projectOrthogonalFractionalExtended(P point)
Project a point onto this object.
-
-
-
Method Detail
-
projectOrthogonal
P projectOrthogonal(P point) throws NullPointerException
Project a point onto this object. For PolyLines, there may be multiple valid solutions. In that case the solution that lies on the closest segment is returned. If there is no valid solution on the closest segment, null is returned.- Parameters:
point
- P; the point- Returns:
- P; the projection of the point (may be null if no sensible projection is possible). If the result is not null; the result lies somewhere on this object.
- Throws:
NullPointerException
- when point is null;
-
projectOrthogonalExtended
P projectOrthogonalExtended(P point) throws NullPointerException
Project a point onto this object. For PolyLines, there may be multiple valid solutions. In that case the solution that lies on the closest segment is returned.- Parameters:
point
- P; the point- Returns:
- P; the projection of the point. This result cannot be null, but it may not lie on this object, but, in stead, lie on a line, or plane that extends this object
- Throws:
NullPointerException
- when point is null;
-
projectOrthogonalFractional
double projectOrthogonalFractional(P point) throws NullPointerException
Project a point onto this object. For PolyLines, there may be multiple valid solutions. In that case the solution that lies on the closest segment is returned. If there is no valid solution on the closest segment, null is returned.- Parameters:
point
- P; the point- Returns:
- double; the fractional position of the projection of the point (may be NaN if no sensible projection is possible). If the result is not null; the result lies somewhere on this object.
- Throws:
NullPointerException
- when point is null;
-
projectOrthogonalFractionalExtended
double projectOrthogonalFractionalExtended(P point) throws NullPointerException
Project a point onto this object. For PolyLines, there may be multiple valid solutions. In that case the solution that lies on the closest segment is returned.- Parameters:
point
- P; the point- Returns:
- double; the fractional position of the projection of the point. This result cannot be NaN, but it may be outside the range 0.0 .. 1.0.
- Throws:
NullPointerException
- when point is null;
-
-