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,
,D> PolyLine<L,
,P, R, D, LS> Ray<R,
D, P>
- All Known Implementing Classes:
LineSegment2d
,LineSegment3d
,Polygon2d
,Polygon3d
,PolyLine2d
,PolyLine3d
,Ray2d
,Ray3d
public interface Project<P extends Point<P>>
Projection of points onto objects.
Copyright (c) 2021-2025 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, Wouter Schakel
-
Method Summary
Modifier and TypeMethodDescriptionprojectOrthogonal
(P point) Project a point onto this object.projectOrthogonalExtended
(P point) Project a point onto this object.double
projectOrthogonalFractional
(P point) Project a point onto this object.double
Project a point onto this object.
-
Method Details
-
projectOrthogonal
Project a point onto this object. For PolyLines and Polygons, 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
- the point- Returns:
- 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
- whenpoint
isnull
-
projectOrthogonalExtended
Project a point onto this object. For PolyLines and Polygons, there may be multiple valid solutions. In that case the solution that lies on the closest segment is returned.- Parameters:
point
- the point- Returns:
- 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
- whenpoint
isnull
-
projectOrthogonalFractional
Project a point onto this object. For PolyLines and Polygons, 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,NaN
is returned.- Parameters:
point
- the point- Returns:
- the fractional position of the projection of the point (may be
NaN
if no sensible projection is possible). If the result is notNaN
; the result lies somewhere on this object. - Throws:
NullPointerException
- whenpoint
isnull
-
projectOrthogonalFractionalExtended
Project a point onto this object. For PolyLines and Polygons, there may be multiple valid solutions. In that case the solution that lies on the closest segment is returned.- Parameters:
point
- the point- Returns:
- 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
- whenpoint
isnull
-