public final class Line extends Segment implements Serializable
Geometry.GeometryAccelerationDegree, Geometry.GeometryType, Geometry.Type
Constructor and Description |
---|
Line()
Creates a line segment.
|
Line(double x1,
double y1,
double x2,
double y2) |
Modifier and Type | Method and Description |
---|---|
void |
applyTransformation(Transformation2D transform)
Applies 2D affine transformation in XY plane.
|
double |
calculateLength2D()
Calculates the length of the geometry.
|
Geometry |
createInstance()
Creates an instance of an empty geometry of the same type.
|
Segment |
cut(double t1,
double t2)
Returns subsegment between parameters t1 and t2.
|
boolean |
equals(Object other) |
long |
estimateMemorySize()
Returns an estimate of this object size in bytes.
|
double |
getAttributeAsDbl(double t,
int semantics,
int ordinate)
Returns the attribute on the segment for the given parameter value.
|
double |
getClosestCoordinate(Point2D inputPt,
boolean bExtrapolate)
Finds a closest coordinate on this segment.
|
void |
getCoord2D(double t,
Point2D pt)
Returns the coordinate of the point on this segment for the given
parameter value (segments are parametric curves).
|
Geometry.Type |
getType()
Returns the geometry type.
|
int |
intersectionWithAxis2D(boolean b_axis_x,
double ordinate,
double[] result_ordinates,
double[] parameters)
Calculates intersection points of this segment with an infinite line,
parallel to one of the axes.
|
boolean |
isCurve()
Indicates if the line segment is a curve.
|
boolean |
isIntersecting(Point2D pt,
double tolerance)
Returns True if point and the segment intersect (not disjoint) for the
given tolerance.
|
void |
queryEnvelope(Envelope env)
Returns the axis aligned bounding box of the geometry.
|
void |
queryEnvelope2D(Envelope2D env)
Returns tight bbox of the Geometry in X, Y plane.
|
void |
replaceNaNs(int semantics,
double value)
Replaces NaNs in the attribute with the given value.
|
String |
toString()
The output of this method can be only used for debugging.
|
_assignVertexDescriptionImpl, calculateArea2D, copyTo, distance, getBoundary, getCoord2D, getDimension, getEndAttributeAsDbl, getEndAttributeAsInt, getEndX, getEndXY, getEndXY, getEndXYZ, getEndY, getStartAttributeAsDbl, getStartAttributeAsInt, getStartX, getStartXY, getStartXY, getStartXYZ, getStartY, isEmpty, isEmptyImpl, isIntersecting, queryEnd, queryInterval, queryStart, setEmpty, setEnd, setEndAttribute, setEndAttribute, setEndXY, setEndXY, setEndXYZ, setEndXYZ, setStart, setStartAttribute, setStartAttribute, setStartXY, setStartXY, setStartXYZ, setStartXYZ
_getImpl, addAttribute, addID, addM, assignVertexDescription, copy, dropAllAttributes, dropAttribute, estimateMemorySize, getDescription, getDimensionFromType, getStateFlag, hasAttribute, hasID, hasM, hasZ, isArea, isLinear, isMultiPath, isMultiVertex, isPoint, isSegment, mergeVertexDescription, queryLooseEnvelope2D, vertex_count
public Line()
public Line(double x1, double y1, double x2, double y2)
public Geometry.Type getType()
Geometry
public long estimateMemorySize()
Geometry
This estimate doesn't include the size of the VertexDescription
object
because instances of VertexDescription
are shared among
geometry objects.
estimateMemorySize
in class Geometry
public double calculateLength2D()
Geometry
GeometryEngine
calculateLength2D
in class Geometry
public boolean isCurve()
public void queryEnvelope(Envelope env)
Geometry
queryEnvelope
in class Geometry
env
- The envelope to return the result in.public void queryEnvelope2D(Envelope2D env)
Geometry
queryEnvelope2D
in class Geometry
env
- The envelope to return the result in.public void applyTransformation(Transformation2D transform)
Geometry
applyTransformation
in class Geometry
transform
- The affine transformation to be applied to this geometry.public Geometry createInstance()
Geometry
createInstance
in class Geometry
public void getCoord2D(double t, Point2D pt)
Segment
getCoord2D
in class Segment
t
- the parameter coordinate along the segment from 0.0 to 1.0.
Value of 0 returns the start point, 1 returns end point.pt
- the coordinate where result will be placed.public Segment cut(double t1, double t2)
Segment
public double getAttributeAsDbl(double t, int semantics, int ordinate)
Segment
getAttributeAsDbl
in class Segment
public double getClosestCoordinate(Point2D inputPt, boolean bExtrapolate)
Segment
getClosestCoordinate
in class Segment
inputPt
- The 2D point to find the closest coordinate on this segment.bExtrapolate
- TRUE if the segment is extrapolated at the end points along
the end point tangents. Otherwise the result is limited to
values between 0 and 1.public int intersectionWithAxis2D(boolean b_axis_x, double ordinate, double[] result_ordinates, double[] parameters)
Segment
intersectionWithAxis2D
in class Segment
b_axis_x
- TRUE if the function works with the line parallel to the axis
X.ordinate
- The ordinate value of the line (x for axis Y, y for axis X).result_ordinates
- The value of ordinate in the intersection points One ordinate
is equal to the ordinate parameter. This parameter can be
NULL.parameters
- The value of the parameter in the intersection points (between
0 and 1). This parameter can be NULL.public boolean isIntersecting(Point2D pt, double tolerance)
isIntersecting
in class Segment
public void replaceNaNs(int semantics, double value)
Geometry
replaceNaNs
in class Geometry
semantics
- The semantics for which to replace the NaNs.value
- The value to replace NaNs with.Copyright © 2018. All rights reserved.