Package org.tinfour.utils.alphashape
Class AlphaCircle
- java.lang.Object
-
- org.tinfour.utils.alphashape.AlphaCircle
-
public class AlphaCircle extends Object
Provides definitions to be used for alpha-shape construction or other applications for a pair of circles of radius r that intersects the endpoints of a line segment.
-
-
Field Summary
Fields Modifier and Type Field Description doublecenterX0X coordinate for a circle center that lies to the left of the defining segmentdoublecenterX1X coordinate for a circle center that lies to the right of the defining segmentdoublecenterY0Y coordinate for a circle center that lies to the left of the defining segmentdoublecenterY1Y coordinate for a circle center that lies to the right of the defining segmentbooleanpartialIndicates that the input segment was of length greater than the radiusdoublerRadius used to construct the circlesbooleanvalidIndicates that the alpha circles are properly defined
-
Constructor Summary
Constructors Constructor Description AlphaCircle(double r, double x0, double y0, double x1, double y1)Construct an object giving elements for two circles of radius r that intersect the specified line-segment endpoints.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description doublegetDistance(double x, double y)Computes the distance from the specified coordinates to the nearest circle center.static booleanisCovered(IQuadEdge edge, double radius, boolean classicAlphaShape)Determines whether the associated edge is exposed or covered (unexposed).booleanisPointInCircleLeft(double x, double y)Indicates whether the specified coordinate are within an alpha circle with a center located to the left of the specified line segment.booleanisPointInCircleRight(double x, double y)Indicates whether the specified coordinate are within an alpha circle with a center located to the right of the specified line segment.booleanisPointInCircles(double x, double y)Indicates whether the specified coordinates are inside one of the two open circles represented by this object.
-
-
-
Field Detail
-
r
public final double r
Radius used to construct the circles
-
centerX0
public final double centerX0
X coordinate for a circle center that lies to the left of the defining segment
-
centerY0
public final double centerY0
Y coordinate for a circle center that lies to the left of the defining segment
-
centerX1
public final double centerX1
X coordinate for a circle center that lies to the right of the defining segment
-
centerY1
public final double centerY1
Y coordinate for a circle center that lies to the right of the defining segment
-
valid
public final boolean valid
Indicates that the alpha circles are properly defined
-
partial
public final boolean partial
Indicates that the input segment was of length greater than the radius
-
-
Constructor Detail
-
AlphaCircle
public AlphaCircle(double r, double x0, double y0, double x1, double y1)Construct an object giving elements for two circles of radius r that intersect the specified line-segment endpoints. The primary computation yields the coordinates for two points giving the centers of the circles.- Parameters:
r- the radius of the two circlesx0- X coordinate of the first pointy0- Y coordinate of the first pointx1- X coordinate of the second pointy1- Y coordinate of the second point
-
-
Method Detail
-
isPointInCircles
public boolean isPointInCircles(double x, double y)Indicates whether the specified coordinates are inside one of the two open circles represented by this object.- Parameters:
x- the X coordinate for the point of interest.y- the Y coordinate for the point of interest- Returns:
- true if the point is inside an open circle defined by this object.
-
isPointInCircleLeft
public boolean isPointInCircleLeft(double x, double y)Indicates whether the specified coordinate are within an alpha circle with a center located to the left of the specified line segment. Points lying on the circle edge are not considered to be within the circle.- Parameters:
x- a valid Cartesian coordinatey- a valid Cartesian coordinate- Returns:
- true if the distance from the specified coordinates to the circle center is less than the circle radius.
-
isPointInCircleRight
public boolean isPointInCircleRight(double x, double y)Indicates whether the specified coordinate are within an alpha circle with a center located to the right of the specified line segment. Points lying on the circle edge are not considered to be within the circle.- Parameters:
x- a valid Cartesian coordinatey- a valid Cartesian coordinate- Returns:
- true if the distance from the specified coordinates to the circle center is less than the circle radius.
-
getDistance
public double getDistance(double x, double y)Computes the distance from the specified coordinates to the nearest circle center.- Parameters:
x- a valid real-valued coordinatey- a valid real-valued coordinate- Returns:
- a positive, potentially zero value
-
isCovered
public static boolean isCovered(IQuadEdge edge, double radius, boolean classicAlphaShape)
Determines whether the associated edge is exposed or covered (unexposed). The standard alpha-shape algorithm classifies an edge as being "exposed" if at least one of its associated alpha circles that does not contain a vertex. The Tinfour modifed algorithm used an alternate definition that requires that both circles are empty. Thus, the standard definition tends to classify more edges as exposed rather than covered.Interpreting the classicAlphaShape option:
- true: Standard definition. An edge is exposed if at least one of its associated alpha-circles does not contain a vertex.
- false: Tinfour-modified definition. An edge is exposed only if both of its associated alpha-circles do not contain a vertex.
- Parameters:
edge- a valid edge from a current incremental TIN instance.radius- the radius of the two circles associated with the edgeclassicAlphaShape- indicates that constructor applies the traditional alpha-circle logic which tends to treat more edges as alpha-exposed than the non-traditional Tinfour variation.- Returns:
- true if the edge is covered; false if the edge is exposed.
-
-