Class 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
      double centerX0
      X coordinate for a circle center that lies to the left of the defining segment
      double centerX1
      X coordinate for a circle center that lies to the right of the defining segment
      double centerY0
      Y coordinate for a circle center that lies to the left of the defining segment
      double centerY1
      Y coordinate for a circle center that lies to the right of the defining segment
      boolean partial
      Indicates that the input segment was of length greater than the radius
      double r
      Radius used to construct the circles
      boolean valid
      Indicates 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
      double getDistance​(double x, double y)
      Computes the distance from the specified coordinates to the nearest circle center.
      static boolean isCovered​(IQuadEdge edge, double radius, boolean classicAlphaShape)
      Determines whether the associated edge is exposed or covered (unexposed).
      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.
      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.
      boolean isPointInCircles​(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 circles
        x0 - X coordinate of the first point
        y0 - Y coordinate of the first point
        x1 - X coordinate of the second point
        y1 - 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 coordinate
        y - 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 coordinate
        y - 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 coordinate
        y - 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 edge
        classicAlphaShape - 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.