public class GeometryUtils
extends java.lang.Object
Constructor and Description |
---|
GeometryUtils() |
Modifier and Type | Method and Description |
---|---|
static double |
findNearestPoint(Point3d pr,
java.util.List<Point3d> vtxs,
boolean closed,
Point3d p0,
double r0)
Finds the nearest point on a polyline to a prescribed point
p0 . |
static double |
findPointAtDistance(Point3d pr,
java.util.List<Point3d> vtxs,
boolean closed,
Point3d p0,
double dist,
double r0)
Finds the point on a polyline that is a specified distance
dist
from a prescribed point p0 , within machine precision. |
static double |
getCharacteristicLength(java.util.Collection<Point3d> pnts)
Finds the characteristic length of a collection of points.
|
public static double getCharacteristicLength(java.util.Collection<Point3d> pnts)
pnts
- points to querypublic static double findPointAtDistance(Point3d pr, java.util.List<Point3d> vtxs, boolean closed, Point3d p0, double dist, double r0)
dist
from a prescribed point p0
, within machine precision. The
polyline is specified by a list of vertices vtxs
. Point locations
on the polyline are described by a non-negative parameter r
,
which takes the form
r = k + swhere
k
is the index of a polyline vertex, and s
is
a scalar parameter in the range [0,1] that specifies the location along
the interval between vertices k
and k+1
. If the
polyline is open, the search for the distance point begins at a location
specified by r0
and locations before r0
are ignored. If
the polyline is closed, r0
is ignored.
If found, the method will return the point's location parameter r
, as well as the point's value in the optional parameter pr
if
it is not null
. If the point is not found, the method will return
-1.
It is assumed that no two adjacent vertices on the polyline are identical within machine precision. If they are, an exception will be thrown.
pr
- if not null
, returns the distance point, if foundvtxs
- list of vertices defining the polylineclosed
- true
if the polyline is closedp0
- point with respect to which distance should be determineddist
- desired distance from p0
r0
- for open polylines, a non-negative scalar giving the location
on the polyline where the search should start. This should be a
non-negative scalar whose value is less than or equal to the number of
polyline intervals, which will be vtxs.size()-1
.public static double findNearestPoint(Point3d pr, java.util.List<Point3d> vtxs, boolean closed, Point3d p0, double r0)
p0
. The polyline is specified by a list of vertices vtxs
. Locations on the polyline are described by a non-negative
parameter r
, which takes the form
r = k + swhere
k
is the index of a polyline vertex, and s
is a scalar parameter in the range [0,1] that specifies the location
along the interval between vertices k
and k+1
. If the
polyline is open, the search for the nearest point begins at a location
specified by r0
and locations before r0
are ignored. If
the polyline is closed, r0
is ignored. The nearest point may not be
unique.
The method will return the nearest point's location parameter r
, as well as the point's value in the optional parameter pr
if
it is not null
. If the polyline is empty, both r
and
pr
at set to 0.
It is assumed that no two adjacent vertices on the polyline are identical within machine precision. If they are, an exception will be thrown.
pr
- if not null
, returns the nearest pointvtxs
- list of vertices defining the polylineclosed
- true
if the polyline is closedp0
- point for which the nearest point should be determinedr0
- for open polylines, a non-negative scalar giving the location
on the polyline where the search should start. This should be a
non-negative scalar whose value is less than or equal to the number of
polyline intervals, which will be vtxs.size()-1
.