Class Vertex

Hierarchy: Object , Vertex
Direct Known Subclasses: ConstraintVertex
public class Vertex
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.

Authors:
David Skea
Martin Davis
public Vertex(double _x, double _y)
public Vertex(double _x, double _y, double _z)
public Vertex(Coordinate _p)
public double getX()
public double getY()
public double getZ()
public void setZ(double _z)
public Coordinate getCoordinate()
public String toString()
public boolean equals(Vertex _x)
public boolean equals(Vertex _x, double tolerance)
public int classify(Vertex p0, Vertex p1)
public 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).
Parameters:
a - a a vertex of the triangle
b - b a vertex of the triangle
c - c a vertex of the triangle
Returns:
true if this vertex is in the circumcircle of (a,b,c)
public final boolean isCCW(Vertex b, Vertex c)
Tests whether the triangle formed by this vertex and two other vertices is in CCW orientation.
Parameters:
b - b a vertex
c - c a vertex
Returns:
true if the triangle is oriented CCW
public final boolean rightOf(QuadEdge e)
public final boolean leftOf(QuadEdge e)
public double circumRadiusRatio(Vertex b, Vertex c)
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 - b second vertex of the triangle
c - c third vertex of the triangle
Returns:
ratio of circumradius to shortest edge.
public Vertex midPoint(Vertex a)
returns a new vertex that is mid-way between this vertex and another end point.
Parameters:
a - a the other end point.
Returns:
the point mid-way between this and that.
public Vertex circleCenter(Vertex b, Vertex c)
Computes the centre of the circumcircle of this vertex and two others.
Parameters:
b - b
c - c
Returns:
the Coordinate which is the circumcircle of the 3 points.
public 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.
public static 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. The containing triangle must not be degenerate (in other words, the three vertices must enclose a non-zero area).
Parameters:
p - p the point to interpolate the Z value of
v0 - v0 a vertex of a triangle containing the p
v1 - v1 a vertex of a triangle containing the p
v2 - v2 a vertex of a triangle containing the p
Returns:
the interpolated Z-value (height) of the point
public static double interpolateZ(Coordinate p, Coordinate p0, Coordinate p1)
Computes the interpolated Z-value for a point p lying on the segment p0-p1
Parameters:
p - p
p0 - p0
p1 - p1
Returns:
the interpolated Z value