Class PolylineWithZProfile
java.lang.Object
com.amalgamasimulation.geometry.geometry3d.PolylineWithZProfile
Class representing a polyline in 3D space that is defined by a 2D
Polyline and an elevation (z) profile along its length. Vertical
segments are not considered correctly; z changes are distributed along the XY
length using the provided profile.
NaNs and infinite coordinates are allowed and there are no checks that prevent creating such polylines. These coordinates are not supported in most methods and may cause errors; such special cases are not described below.
- Author:
- Andrey Malykhanov
-
Constructor Summary
ConstructorsConstructorDescriptionPolylineWithZProfile(Point3D... points) PolylineWithZProfile(List<Point3D> points) Creates a new polyline with z profile from the specified list of 3D points. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns all intersection descriptors between this polyline and the specified polyline, where both XY intersection and equal z are present at the same offsets.Returns the first point of the polyline as aPoint3Dinstance.Returns all inner points of the polyline (i.e., points between the first and last) as 3D coordinates.Returns the last point of the polyline as aPoint3Dinstance.doubleCalculates the total length of this polyline taking into account both the 2D path and the Z-profile (elevation changes).Returns list of all points of this polyline.Returns the range of x-coordinates covered by this polyline as an interval.Returns the range of y-coordinates covered by this polyline as an interval.doublegetZAtAbsOffset(double absOffset) Returns the z-coordinate at the specified absolute offset along the polyline measured in the XY-plane.Returns the range of z-coordinates (elevations) covered by this polyline as an interval.inthashCode()splitAtAbsOffsets(List<Double> absOffsets) Splits this polyline into sub-polylines at the specified absolute offsets measured along the XY-plane.toString()
-
Constructor Details
-
PolylineWithZProfile
Creates a new polyline with z profile from the specified list of 3D points. Points are connected in order in the XY-plane, and z is interpolated along each XY segment according to the provided point elevations.- Parameters:
points- ordered list of points forming the polyline- Throws:
IllegalArgumentException- if fewer than two points are provided
-
PolylineWithZProfile
-
-
Method Details
-
getZAtAbsOffset
public double getZAtAbsOffset(double absOffset) Returns the z-coordinate at the specified absolute offset along the polyline measured in the XY-plane.- Parameters:
absOffset- absolute offset along the polyline length in the XY-plane- Returns:
- z-coordinate at the specified offset
-
getAllIntersections
Returns all intersection descriptors between this polyline and the specified polyline, where both XY intersection and equal z are present at the same offsets.- Parameters:
other- the specified polyline with z profile- Returns:
- list of intersection descriptors with matching XY and z
-
getXRange
Returns the range of x-coordinates covered by this polyline as an interval.- Returns:
- interval representing the minimum and maximum x-coordinates
-
getYRange
Returns the range of y-coordinates covered by this polyline as an interval.- Returns:
- interval representing the minimum and maximum y-coordinates
-
getZRange
Returns the range of z-coordinates (elevations) covered by this polyline as an interval.- Returns:
- interval representing the minimum and maximum z-coordinates
-
splitAtAbsOffsets
Splits this polyline into sub-polylines at the specified absolute offsets measured along the XY-plane. The offsets collection should be sorted in ascending order.- Parameters:
absOffsets- absolute offsets where the polyline should be split- Returns:
- list of sub-polylines covering the full length
-
getLength
public double getLength()Calculates the total length of this polyline taking into account both the 2D path and the Z-profile (elevation changes).- Returns:
- the total 3D length of the polyline, calculated as the sum of 3D Euclidean distances of all segments
-
getPoints
Returns list of all points of this polyline.- Returns:
- list of 3D points
-
getInnerPoints
Returns all inner points of the polyline (i.e., points between the first and last) as 3D coordinates.- Returns:
- list of inner 3D points
-
getFirstPoint
Returns the first point of the polyline as aPoint3Dinstance.- Returns:
- first 3D point of the polyline
-
getLastPoint
Returns the last point of the polyline as aPoint3Dinstance.- Returns:
- last 3D point of the polyline
-
getPolyline2d
-
toString
-
hashCode
public int hashCode() -
equals
-