Class IntegrityCheck

  • All Implemented Interfaces:
    IIntegrityCheck

    public class IntegrityCheck
    extends Object
    implements IIntegrityCheck
    A tool for checking the correctness of a tin, in particular the relationship between adjacent triangles. The name of this class is inspired by the idea of a "relational integrity check" in relational database management systems. And that choice of nomenclature should give some sense of its intended role.
    • Method Detail

      • inspect

        public boolean inspect()
        Performs an inspection of the TIN checking for conditions that violate the construction rules.

        The Rules

        • Ensure that every edge links to two valid triangular circuits (one on each side).
        • Ensure that the set of ghost triangles forms a closed loop around the convex hull (perimeter) of the TIN
        • Ensure that all ghost triangles are included in the perimeter loop
        • Ensure that no triangles are degenerate (negative or zero area)
        • Ensure that all triangle pairs are Delaunay or close-to-Delaunay optimal
        Specified by:
        inspect in interface IIntegrityCheck
        Returns:
        if the TIN passes inspection, true; otherwise, false.
      • inspectLinks

        public boolean inspectLinks()
        Inspects the references that connect various edges in the TIN. This test passes if the following conditions are met:
        • Proper triangular circuits are formed
        • Forward and reverse references are mutually consistent
        • All allocated edges are fully populated with references
        If an inspection fails, information about the cause may be obtained through a call to getMessage().
        Returns:
        true if all inspection criteria are met; otherwise false.
      • inspectPerimeterLinks

        public boolean inspectPerimeterLinks()
        Inspects the edges related to the perimeter (convex hull) of the TIN. This test passes if the following conditions are met:
        • The dual of all perimeter edges is the base of a ghost triangle.
        • Forward and reverse references are mutually consistent
        • The number of perimeter edges equals the number of ghost edges
        • The area of the perimeter as obtained using the getPermiter() method is greater than zero (e.g. has a counterclockwise orientation).
        If an inspection fails, information about the cause may be obtained through a call to getMessage().
        Returns:
        true if all inspection criteria are met; otherwise false.
      • inspectTriangleGeometry

        public boolean inspectTriangleGeometry()
        Inspects the triangles forming the TIN. This test passes if the following conditions are met:
        • All triangles are non-degenerate (have an area greater than zero).
        • The two triangles associated with each edge do not violate the Delaunay criterion within a degree of tolerance specified by the delaunayThreshold for the TIN.
        This inspection has a limitation in that the method of checking the Delaunay criterion uses the same finite-precision logic that the TIN building routine uses. So, at best, a passing result verifies that the logic is self-consistent, but does not guarantee that the triangular mesh is truly Delaunay optimal.

        If an inspection fails, information about the cause may be obtained through a call to getMessage().

        Returns:
        true if all inspection criteria are met; otherwise false.
      • getMessage

        public String getMessage()
        Gets descriptive information about the cause of a test failure.
        Specified by:
        getMessage in interface IIntegrityCheck
        Returns:
        if a failure occurred, descriptive information; otherwise a string indicating that No Error Detected.
      • isCheckOkay

        public boolean isCheckOkay()
        Determines whether the most recent integrity check completed okay.
        Returns:
        true if the integrity check was okay.
      • printSummary

        public void printSummary​(PrintStream ps)
        Description copied from interface: IIntegrityCheck
        Prints a summary of data collected during inspection of a TIN.
        Specified by:
        printSummary in interface IIntegrityCheck
        Parameters:
        ps - a print stream to receive the output.
      • testGetVerticesAgainstInputList

        public boolean testGetVerticesAgainstInputList​(List<Vertex> inputList)
        Description copied from interface: IIntegrityCheck
        Compares the list of vertices from the getVertices() method to the original list of input vertices and determines whether they are consistent. The getVertices method must return one, and only one, instance of each vertex in the input list.

        This method does not account for cases where constraints have been added to the TIN. If constraints have been added, it will return a value of false.

        Important: The test assumes that each vertex in the input set is unique. If a vertex occurs more than once, the test will fail.

        Specified by:
        testGetVerticesAgainstInputList in interface IIntegrityCheck
        Parameters:
        inputList - the list of vertices input into the TIN.
        Returns:
        true if the test passes; otherwise false
      • getConstrainedViolationCount

        public int getConstrainedViolationCount()
        Description copied from interface: IIntegrityCheck
        Gets the number of constrained edges that would violate the Delaunay criterion
        Specified by:
        getConstrainedViolationCount in interface IIntegrityCheck
        Returns:
        a positive integer.
      • getConstrainedViolationMaximum

        public double getConstrainedViolationMaximum()
        Description copied from interface: IIntegrityCheck
        Get the maximum calculated in-circle score for constrained edges that violate the Delaunay criterion
        Specified by:
        getConstrainedViolationMaximum in interface IIntegrityCheck
        Returns:
        a positive number, or zero if no violations occurred.
      • getContrainedViolationAverage

        public double getContrainedViolationAverage()
        Description copied from interface: IIntegrityCheck
        Get the average calculated in-circle score for constrained edges that violate the Delaunay criterion
        Specified by:
        getContrainedViolationAverage in interface IIntegrityCheck
        Returns:
        a positive number, or zero if no violations occurred.