Class Vertex
java.lang.Object
org.locationtech.jts.triangulate.quadedge.Vertex
- Direct Known Subclasses:
ConstraintVertex
Models a site (node) in a
QuadEdgeSubdivision
.
The sites can be points on a line string representing a
linear site.
The vertex can be considered as a vector with a norm, length, inner product, cross product, etc. Additionally, point relations (e.g., is a point to the left of a line, the circle defined by this point and two others, etc.) are also defined in this class.
It is common to want to attach user-defined data to the vertices of a subdivision. One way to do this is to subclass Vertex to carry any desired information.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final int
static final int
private Coordinate
static final int
-
Constructor Summary
ConstructorsConstructorDescriptionVertex
(double _x, double _y) Vertex
(double _x, double _y, double _z) Vertex
(Coordinate _p) -
Method Summary
Modifier and TypeMethodDescriptionprivate HCoordinate
circleCenter
(Vertex b, Vertex c) Computes the centre of the circumcircle of this vertex and two others.double
circumRadiusRatio
(Vertex b, Vertex c) Computes the value of the ratio of the circumradius to shortest edge.int
(package private) Vertex
cross()
(package private) double
Computes the cross product k = u X v.private double
(package private) double
Computes the inner or dot productboolean
boolean
double
getX()
double
getY()
double
getZ()
static double
interpolateZ
(Coordinate p, Coordinate p0, Coordinate p1) Computes the interpolated Z-value for a point p lying on the segment p0-p1static double
interpolateZ
(Coordinate p, Coordinate v0, Coordinate v1, Coordinate v2) Interpolates the Z-value (height) of a point enclosed in a triangle whose vertices all have Z values.double
interpolateZValue
(Vertex v0, Vertex v1, Vertex v2) For this vertex enclosed in a triangle defined by three vertices v0, v1 and v2, interpolate a z value from the surrounding vertices.final boolean
Tests whether the triangle formed by this vertex and two other vertices is in CCW orientation.boolean
isInCircle
(Vertex a, Vertex b, Vertex c) Tests if the vertex is inside the circle defined by the triangle with vertices a, b, c (oriented counter-clockwise).final boolean
(package private) double
magn()
returns a new vertex that is mid-way between this vertex and another end point.final boolean
void
setZ
(double _z) (package private) Vertex
(package private) Vertex
(package private) Vertex
times
(double c) Computes the scalar product c(v)toString()
-
Field Details
-
LEFT
public static final int LEFT- See Also:
-
RIGHT
public static final int RIGHT- See Also:
-
BEYOND
public static final int BEYOND- See Also:
-
BEHIND
public static final int BEHIND- See Also:
-
BETWEEN
public static final int BETWEEN- See Also:
-
ORIGIN
public static final int ORIGIN- See Also:
-
DESTINATION
public static final int DESTINATION- See Also:
-
p
-
-
Constructor Details
-
Vertex
public Vertex(double _x, double _y) -
Vertex
public Vertex(double _x, double _y, double _z) -
Vertex
-
-
Method Details
-
getX
public double getX() -
getY
public double getY() -
getZ
public double getZ() -
setZ
public void setZ(double _z) -
getCoordinate
-
toString
-
equals
-
equals
-
classify
-
crossProduct
Computes the cross product k = u X v.- Parameters:
v
- a vertex- Returns:
- returns the magnitude of u X v
-
dot
Computes the inner or dot product- Parameters:
v
- a vertex- Returns:
- returns the dot product u.v
-
times
Computes the scalar product c(v)- Parameters:
v
- a vertex- Returns:
- returns the scaled vector
-
sum
-
sub
-
magn
double magn() -
cross
Vertex cross() -
isInCircle
Tests if the vertex is inside the circle defined by the triangle with vertices a, b, c (oriented counter-clockwise).- Parameters:
a
- a vertex of the triangleb
- a vertex of the trianglec
- a vertex of the triangle- Returns:
- true if this vertex is in the circumcircle of (a,b,c)
-
isCCW
Tests whether the triangle formed by this vertex and two other vertices is in CCW orientation.- Parameters:
b
- a vertexc
- a vertex- Returns:
- true if the triangle is oriented CCW
-
rightOf
-
leftOf
-
bisector
-
distance
-
circumRadiusRatio
Computes the value of the ratio of the circumradius to shortest edge. If smaller than some given tolerance B, the associated triangle is considered skinny. For an equal lateral triangle this value is 0.57735. The ratio is related to the minimum triangle angle theta by: circumRadius/shortestEdge = 1/(2sin(theta)).- Parameters:
b
- second vertex of the trianglec
- third vertex of the triangle- Returns:
- ratio of circumradius to shortest edge.
-
midPoint
returns a new vertex that is mid-way between this vertex and another end point.- Parameters:
a
- the other end point.- Returns:
- the point mid-way between this and that.
-
circleCenter
Computes the centre of the circumcircle of this vertex and two others.- Parameters:
b
-c
-- Returns:
- the Coordinate which is the circumcircle of the 3 points.
-
interpolateZValue
For this vertex enclosed in a triangle defined by three vertices v0, v1 and v2, interpolate a z value from the surrounding vertices. -
interpolateZ
Interpolates the Z-value (height) of a point enclosed in a triangle whose vertices all have Z values. The containing triangle must not be degenerate (in other words, the three vertices must enclose a non-zero area).- Parameters:
p
- the point to interpolate the Z value ofv0
- a vertex of a triangle containing the pv1
- a vertex of a triangle containing the pv2
- a vertex of a triangle containing the p- Returns:
- the interpolated Z-value (height) of the point
-
interpolateZ
Computes the interpolated Z-value for a point p lying on the segment p0-p1- Parameters:
p
-p0
-p1
-- Returns:
- the interpolated Z value
-