Package org.tinfour.standard
Class IntegrityCheck
- java.lang.Object
-
- org.tinfour.standard.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 Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetConstrainedViolationCount()Gets the number of constrained edges that would violate the Delaunay criteriondoublegetConstrainedViolationMaximum()Get the maximum calculated in-circle score for constrained edges that violate the Delaunay criteriondoublegetContrainedViolationAverage()Get the average calculated in-circle score for constrained edges that violate the Delaunay criterionStringgetMessage()Gets descriptive information about the cause of a test failure.booleaninspect()Performs an inspection of the TIN checking for conditions that violate the construction rules.booleaninspectLinks()Inspects the references that connect various edges in the TIN.booleaninspectPerimeterLinks()Inspects the edges related to the perimeter (convex hull) of the TIN.booleaninspectTriangleGeometry()Inspects the triangles forming the TIN.booleanisCheckOkay()Determines whether the most recent integrity check completed okay.voidprintSummary(PrintStream ps)Prints a summary of data collected during inspection of a TIN.booleantestGetVerticesAgainstInputList(List<Vertex> inputList)Compares the list of vertices from the getVertices() method to the original list of input vertices and determines whether they are consistent.
-
-
-
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:
inspectin interfaceIIntegrityCheck- 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
- 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).
- 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.
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:
getMessagein interfaceIIntegrityCheck- 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:IIntegrityCheckPrints a summary of data collected during inspection of a TIN.- Specified by:
printSummaryin interfaceIIntegrityCheck- Parameters:
ps- a print stream to receive the output.
-
testGetVerticesAgainstInputList
public boolean testGetVerticesAgainstInputList(List<Vertex> inputList)
Description copied from interface:IIntegrityCheckCompares 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:
testGetVerticesAgainstInputListin interfaceIIntegrityCheck- 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:IIntegrityCheckGets the number of constrained edges that would violate the Delaunay criterion- Specified by:
getConstrainedViolationCountin interfaceIIntegrityCheck- Returns:
- a positive integer.
-
getConstrainedViolationMaximum
public double getConstrainedViolationMaximum()
Description copied from interface:IIntegrityCheckGet the maximum calculated in-circle score for constrained edges that violate the Delaunay criterion- Specified by:
getConstrainedViolationMaximumin interfaceIIntegrityCheck- Returns:
- a positive number, or zero if no violations occurred.
-
getContrainedViolationAverage
public double getContrainedViolationAverage()
Description copied from interface:IIntegrityCheckGet the average calculated in-circle score for constrained edges that violate the Delaunay criterion- Specified by:
getContrainedViolationAveragein interfaceIIntegrityCheck- Returns:
- a positive number, or zero if no violations occurred.
-
-