Class PlanarPolygon3D
java.lang.Object
org.locationtech.jts.operation.distance3d.PlanarPolygon3D
Models a polygon lying in a plane in 3-dimensional Cartesian space.
The polygon representation is supplied
by a
Polygon
,
containing coordinates with XYZ ordinates.
3D polygons are assumed to lie in a single plane.
The plane best fitting the polygon coordinates is
computed and is represented by a Plane3D
.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate Vector3D
Computes an average normal vector from a list of polygon coordinates.private Coordinate
Computes a point which is the average of all coordinates in a sequence.private Plane3D
findBestFitPlane
(Polygon poly) Finds a best-fit plane for the polygon, by sampling a few points from the exterior ring.getPlane()
boolean
intersects
(Coordinate intPt) boolean
intersects
(Coordinate pt, LineString ring) private int
locate
(Coordinate pt, LineString ring) private static Coordinate
project
(Coordinate p, int facingPlane) private static CoordinateSequence
project
(CoordinateSequence seq, int facingPlane)
-
Field Details
-
plane
-
poly
-
facingPlane
private int facingPlane
-
-
Constructor Details
-
PlanarPolygon3D
-
-
Method Details
-
findBestFitPlane
Finds a best-fit plane for the polygon, by sampling a few points from the exterior ring.The algorithm used is Newell's algorithm: - a base point for the plane is determined from the average of all vertices - the normal vector is determined by computing the area of the projections on each of the axis planes
- Parameters:
poly
- the polygon to determine the plane for- Returns:
- the best-fit plane
-
averageNormal
Computes an average normal vector from a list of polygon coordinates. Uses Newell's method, which is based on the fact that the vector with components equal to the areas of the projection of the polygon onto the Cartesian axis planes is normal.- Parameters:
seq
- the sequence of coordinates for the polygon- Returns:
- a normal vector
-
averagePoint
Computes a point which is the average of all coordinates in a sequence. If the sequence lies in a single plane, the computed point also lies in the plane.- Parameters:
seq
- a coordinate sequence- Returns:
- a Coordinate with averaged ordinates
-
getPlane
-
getPolygon
-
intersects
-
locate
-
intersects
-
project
-
project
-