Skip to content
Permalink
Browse files

First commit

  • Loading branch information...
gwlucastrig committed Jun 5, 2016
0 parents commit 31903df659e8ba63a9a46b5069c18aa80bb9b295
Showing with 33,676 additions and 0 deletions.
  1. +14 −0 LICENSE.txt
  2. +24 −0 NOTICE.txt
  3. +105 −0 README.md
  4. +105 −0 build.xml
  5. BIN doc/TinfourAlgorithmsAndDataElements.pdf
  6. +31 −0 pmd_ruleset.xml
  7. +1 −0 run.bat
  8. +172 −0 src/main/java/tinfour/common/BootstrapUtility.java
  9. +269 −0 src/main/java/tinfour/common/Circumcircle.java
  10. +523 −0 src/main/java/tinfour/common/GeometricOperations.java
  11. +266 −0 src/main/java/tinfour/common/IIncrementalTin.java
  12. +74 −0 src/main/java/tinfour/common/IIntegrityCheck.java
  13. +118 −0 src/main/java/tinfour/common/IMonitorWithCancellation.java
  14. +60 −0 src/main/java/tinfour/common/INeighborEdgeLocator.java
  15. +106 −0 src/main/java/tinfour/common/INeighborhoodPointsCollector.java
  16. +59 −0 src/main/java/tinfour/common/IProcessUsingTin.java
  17. +106 −0 src/main/java/tinfour/common/IQuadEdge.java
  18. +66 −0 src/main/java/tinfour/common/ISamplePoint.java
  19. +132 −0 src/main/java/tinfour/common/NeighborEdgeVertex.java
  20. +416 −0 src/main/java/tinfour/common/QuadEdge.java
  21. +80 −0 src/main/java/tinfour/common/QuadEdgePartner.java
  22. +237 −0 src/main/java/tinfour/common/Thresholds.java
  23. +124 −0 src/main/java/tinfour/common/TriangleCount.java
  24. +270 −0 src/main/java/tinfour/common/Vertex.java
  25. +217 −0 src/main/java/tinfour/common/VertexMergerGroup.java
  26. +5 −0 src/main/java/tinfour/common/package-info.java
  27. +71 −0 src/main/java/tinfour/gwr/BandwidthSelectionMethod.java
  28. +756 −0 src/main/java/tinfour/gwr/GwrInterpolator.java
  29. +119 −0 src/main/java/tinfour/gwr/NeighborhoodPoint.java
  30. +1,535 −0 src/main/java/tinfour/gwr/SurfaceGwr.java
  31. +82 −0 src/main/java/tinfour/gwr/SurfaceModel.java
  32. +5 −0 src/main/java/tinfour/gwr/package-info.java
  33. +357 −0 src/main/java/tinfour/interpolation/GwrTinInterpolator.java
  34. +98 −0 src/main/java/tinfour/interpolation/IInterpolatorOverTin.java
  35. +58 −0 src/main/java/tinfour/interpolation/IVertexValuator.java
  36. +754 −0 src/main/java/tinfour/interpolation/NaturalNeighborInterpolator.java
  37. +240 −0 src/main/java/tinfour/interpolation/TriangularFacetInterpolator.java
  38. +45 −0 src/main/java/tinfour/interpolation/VertexValuatorDefault.java
  39. +5 −0 src/main/java/tinfour/interpolation/package-info.java
  40. +451 −0 src/main/java/tinfour/las/BufferedRandomAccessForLidar.java
  41. +46 −0 src/main/java/tinfour/las/ILasRecordFilter.java
  42. +454 −0 src/main/java/tinfour/las/LasFileReader.java
  43. +73 −0 src/main/java/tinfour/las/LasPoint.java
  44. +59 −0 src/main/java/tinfour/las/LasRecordFilterByClass.java
  45. +110 −0 src/main/java/tinfour/las/LasVariableLengthRecord.java
  46. +4 −0 src/main/java/tinfour/las/package-info.java
  47. +134 −0 src/main/java/tinfour/standard/DevillersEar.java
  48. +536 −0 src/main/java/tinfour/standard/EdgePool.java
  49. +1,769 −0 src/main/java/tinfour/standard/IncrementalTin.java
  50. +505 −0 src/main/java/tinfour/standard/IntegrityCheck.java
  51. +114 −0 src/main/java/tinfour/standard/NeighborEdgeLocator.java
  52. +416 −0 src/main/java/tinfour/standard/NeighborhoodPointsCollector.java
  53. +507 −0 src/main/java/tinfour/standard/StochasticLawsonsWalk.java
  54. +6 −0 src/main/java/tinfour/standard/package-info.java
  55. +193 −0 src/main/java/tinfour/utils/HilbertSort.java
  56. +249 −0 src/main/java/tinfour/utils/TinInstantiationUtility.java
  57. +4 −0 src/main/java/tinfour/utils/package-info.java
  58. +149 −0 src/main/java/tinfour/virtual/DevillersEar.java
  59. +480 −0 src/main/java/tinfour/virtual/VirtualEdge.java
  60. +182 −0 src/main/java/tinfour/virtual/VirtualEdgePage.java
  61. +475 −0 src/main/java/tinfour/virtual/VirtualEdgePool.java
  62. +1,677 −0 src/main/java/tinfour/virtual/VirtualIncrementalTin.java
  63. +497 −0 src/main/java/tinfour/virtual/VirtualIntegrityCheck.java
  64. +117 −0 src/main/java/tinfour/virtual/VirtualNeighborEdgeLocator.java
  65. +414 −0 src/main/java/tinfour/virtual/VirtualNeighborhoodPointsCollector.java
  66. +521 −0 src/main/java/tinfour/virtual/VirtualStochasticLawsonsWalk.java
  67. +7 −0 src/main/java/tinfour/virtual/package-info.java
  68. +1,404 −0 src/main/java/tinfour/vividsolutions/jts/math/DD.java
  69. +12 −0 src/main/java/tinfour/vividsolutions/jts/math/package-info.java
  70. +463 −0 src/test/java/tinfour/test/examples/ExampleCrossValidation.java
  71. +193 −0 src/test/java/tinfour/test/examples/ExampleGWR.java
  72. +579 −0 src/test/java/tinfour/test/examples/ExampleGridAndHillshade.java
  73. +467 −0 src/test/java/tinfour/test/examples/ExampleMultiThreadTest.java
  74. +453 −0 src/test/java/tinfour/test/examples/ExampleWireframeWithThinning.java
  75. +4 −0 src/test/java/tinfour/test/examples/package-info.java
  76. +4 −0 src/test/java/tinfour/test/package-info.java
  77. +218 −0 src/test/java/tinfour/test/performance/RepeatedBuildTest.java
  78. +241 −0 src/test/java/tinfour/test/performance/SingleBuildTest.java
  79. +296 −0 src/test/java/tinfour/test/performance/TimeDueToSampleSize.java
  80. +232 −0 src/test/java/tinfour/test/performance/TwinBuildTest.java
  81. +9 −0 src/test/java/tinfour/test/performance/package-info.java
  82. +92 −0 src/test/java/tinfour/test/utils/DelimitedReader.java
  83. +306 −0 src/test/java/tinfour/test/utils/GridSpecification.java
  84. +61 −0 src/test/java/tinfour/test/utils/IDevelopmentTest.java
  85. +90 −0 src/test/java/tinfour/test/utils/InterpolationMethod.java
  86. +969 −0 src/test/java/tinfour/test/utils/TestOptions.java
  87. +731 −0 src/test/java/tinfour/test/utils/TestPalette.java
  88. +75 −0 src/test/java/tinfour/test/utils/TestVertices.java
  89. +303 −0 src/test/java/tinfour/test/utils/TinRenderingUtility.java
  90. +581 −0 src/test/java/tinfour/test/utils/VertexLoader.java
  91. +95 −0 src/test/java/tinfour/test/utils/VertexWithClassification.java
  92. +7 −0 src/test/java/tinfour/test/utils/package-info.java
  93. +151 −0 src/test/java/tinfour/test/viewer/DataDropTargetListener.java
  94. +457 −0 src/test/java/tinfour/test/viewer/DataViewerUI.java
  95. +751 −0 src/test/java/tinfour/test/viewer/DataViewingPanel.java
  96. +338 −0 src/test/java/tinfour/test/viewer/ScaleIntervals.java
  97. +177 −0 src/test/java/tinfour/test/viewer/StatusPanel.java
  98. +107 −0 src/test/java/tinfour/test/viewer/StatusPanelMonitor.java
  99. +100 −0 src/test/java/tinfour/test/viewer/TinfourViewerMain.java
  100. +523 −0 src/test/java/tinfour/test/viewer/ViewOptionsPanel.form
  101. +752 −0 src/test/java/tinfour/test/viewer/ViewOptionsPanel.java
  102. +207 −0 src/test/java/tinfour/test/viewer/backplane/BackplaneExecutor.java
  103. +386 −0 src/test/java/tinfour/test/viewer/backplane/BackplaneManager.java
  104. +220 −0 src/test/java/tinfour/test/viewer/backplane/IModel.java
  105. +58 −0 src/test/java/tinfour/test/viewer/backplane/IModelViewTask.java
  106. +351 −0 src/test/java/tinfour/test/viewer/backplane/ModelAdapter.java
  107. +288 −0 src/test/java/tinfour/test/viewer/backplane/ModelFromLas.java
  108. +108 −0 src/test/java/tinfour/test/viewer/backplane/ModelFromText.java
  109. +1,213 −0 src/test/java/tinfour/test/viewer/backplane/MvComposite.java
  110. +108 −0 src/test/java/tinfour/test/viewer/backplane/MvTaskBuildRasterBlock.java
  111. +447 −0 src/test/java/tinfour/test/viewer/backplane/MvTaskBuildTinAndRender.java
  112. +90 −0 src/test/java/tinfour/test/viewer/backplane/MvTaskLoad.java
  113. +103 −0 src/test/java/tinfour/test/viewer/backplane/MvTaskReload.java
  114. +159 −0 src/test/java/tinfour/test/viewer/backplane/MvTaskRender.java
  115. +49 −0 src/test/java/tinfour/test/viewer/backplane/RenderProduct.java
  116. +45 −0 src/test/java/tinfour/test/viewer/backplane/RenderProductType.java
  117. +202 −0 src/test/java/tinfour/test/viewer/backplane/UnitSquareModel.java
  118. +465 −0 src/test/java/tinfour/test/viewer/backplane/ViewOptions.java
  119. +6 −0 src/test/java/tinfour/test/viewer/backplane/package-info.java
  120. +5 −0 src/test/java/tinfour/test/viewer/package-info.java
  121. +47 −0 src/test/java/tinfour/test/viewer/resources/HelpInformation.txt
  122. +24 −0 src/test/java/tinfour/test/viewer/resources/TermsOfUseForIcons.txt
  123. BIN src/test/java/tinfour/test/viewer/resources/camera_16_by_16 (1).png
  124. BIN src/test/java/tinfour/test/viewer/resources/camera_black_16_by_16.png
  125. BIN src/test/java/tinfour/test/viewer/resources/chinese_noodles_16_by_16.png
  126. BIN src/test/java/tinfour/test/viewer/resources/chinese_noodles_32_by_32.png
  127. BIN src/test/java/tinfour/test/viewer/resources/piece_of_cake_16_by_16.png
  128. BIN src/test/java/tinfour/test/viewer/resources/piece_of_cake_32_by_32.png
  129. BIN src/test/java/tinfour/test/viewer/resources/zoom_selection_16_by_16.png
@@ -0,0 +1,14 @@
Copyright (c) 2016 Gary Lucas

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

@@ -0,0 +1,24 @@
Tinfour -- A Software Library
Copyright 22014-2016 G.W. Lucas


===============================================================================
This product includes The Apache Commons Math software library developed at
the Apache Software Foundation (http://www.apache.org/)
and released under the Apache Commons License Version 2.0, available
at http://www.apache.org/licenses// Further notices and licence
files are bundled in the commons-math jar file.

This product includes software developed by the JTS Topology Suite
at http://tsusiatsoftware.net/jts/main.html and released under
the GNU Lesser General Public License available at
http://www.gnu.org/licenses/lgpl-3.0.en.html.

This product includes icons from the FatCow web page at
http://www.fatcow.com/free-icons and distributed under the Create Commons
Attribution 3.0 License.





105 README.md
@@ -0,0 +1,105 @@
Tinfour
========

High-Performance 2D Delaunay Triangulation and Related Utilities Written in Java


### Delaunay Triangulation ###
The Delaunay Triangulation defines an optimal form for organizing unstructured or semi-random
sample points into a triangular mesh. That optimality makes the Delaunay Triangulation
a useful tool for interpolation, grid construction, and surface analysis.

### Tinfour ###
Tinfour is a Java package that provides tools for constructing and applying
Delaunay Triangulations. Because it is intended to process large data sets,
the implementation gives a great deal of attention to performance and
memory use. On a conventional laptop is is capable of processing sample
points at a rate of better than one million points per second.

The Tinfour source code includes extensive Javadoc. This project also includes
an informal paper that describes the algorithms and implementation
details for the software.

### The Tinfour Viewer ###
When someone first sees a project like Tinfour, they might reasonably ask
that most thorny of questions "What is it good for?" To try to address that question,
this libary includes a simple demonstration program which allows the user to view
and explore raw data, including samples such as Lidar files that contain
huge numbers of points. To run the demonstrator, you must have Java installed
on your system. Depending on your setup, you may be able to invoke the viewer
by simply navigating to your copy of the Tinfour "dist" folder and double clicking
the TinfourViewer jar. From the command window, you can invoke the viewer
using the following:
```
java -Xmx1500m -jar TinfourViewer-1.0.jar
```
The demonstrator is intended to show how the Tinfour library could be integrated
into a fully feature GIS application or other analysis tool. It's a simple
implementation with a minimum of features.

### External Project Dependencies ###
Tinfour does have one external project dependency and, at least for now,
you will have to download it manually before you can use Tinfour. The dependency
is on the well-known Apache Commons Math library. Download a recenter version
of the library from
[Apache Commons Math Download](http://commons.apache.org/proper/commons-math/download_math.cgi "Apache Commons Math")
store the jar in the Tinfour/lib directory (folder) and Tinfour will be good to go.

### Sources of Data ###
Lidar is a system for collecting surface elevation using laser measuring devices
mounted on low flying aircraft. It's pretty amazing technology.
There are some excellent sources of Lidar data to be had for free, you might start at
[Free LiDAR Data Sources](http://gisgeography.com/top-6-free-lidar-data-sources/ "Gis Geography")
or [USGS Cebter for LIDAR Information] (http://lidar.cr.usgs.gov/ "USGS")

### A short demo ###
Recently, I found an earlier Delaunay triangulation project by "The Mad Creator" (Bill Dwyer)
that provided a four-line demo. It was such a elegant way of introducing the package,
that I decided to include one of my own.


```Java
public static void main(String []args) throws Exception {
IncrementalTin tin = new IncrementalTin(1.0);
List<Vertex>vertexList = TestVertices.makeRandomVertices(100, 0);
tin.add(vertexList);
TinRenderingUtility.drawTin(tin, 500, 500, new File("tin.png"));
}
```


### Why are there External Project Dependencies? ###
The only external dependency in the Tinfour package is the
[Apache Commons Math Library](https://commons.apache.org/proper/commons-math/).
This dependency is required by the linear algebra and statistics functions
needed by the Geographically Weighted Regression classes. If you have
an alternate linear algebra library in your own software, it would be
possible to refactor the Tinfour code to perform the core regression
functions using the alternative. You would, however, have to remove
those functions that specifically require statistics elements
(such as the T-Distribution) or provide your own alternative

### Configuring Tinfour in an IDE ###
Configuring Tinfour in an IDE is pretty simple:
* Create a Java project
* Set up a source reference to (installed path)Tinfour/src/main/java
so that your IDE picks up the packages tinfour.*
* If you wish to include the test and example applications,
set up a source reference to (installed path)/Tinfour/src/test/java
so your IDE picks up the packages tinfour.test.*
* Set up a jar reference to (installed path)/Tinfour/lib/commons-math-3.3.6.1.jar
* Configure the IDE to run TinfourViewerMain. If you are working with very
large datasets, you may include the Java runtime option -Xmx1500m or larger
to increase the heap size.

### Future Work ###
The primary feature remaining for future work in Tinfour is support
for the constrained Delaunay triangulation to handle breakline features,
boundaries, and other linear features representing discontinuities in
the modeled surface.

I would very much like to extend the Lidar file reader to be able
to process the compressed LAZ format files. Doing so would
make file access far more conveient. I'd also like to have the
reader obtain the metadata from LAS files, particular those
elements using Well-Known Text (WKT) format and GeoTIFF tags.
105 build.xml
@@ -0,0 +1,105 @@
<project name="Tinfour" default="dist" basedir=".">
<description>
preliminary build file for Tinfour
</description>
<!-- set global properties for this build -->
<property name="src.dir" location="src/main/java"/>
<property name="testsrc.dir" location="src/test/java"/>
<property name="javadoc.dir" location="doc/javadoc"/>
<property name="build" location="build"/>
<property name="dist" location="dist"/>

<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}" />
<mkdir dir="${dist}" />
</target>

<path id="build.classpath">
<fileset dir="lib">
<include name="*.jar"/>
</fileset>
</path>

<target name="compile" depends="init" description="compile the source">
<!-- Compile the java code from ${src.dir} into ${build} -->
<javac includeantruntime="false" destdir="${build}" debug="on">
<src path="${src.dir}" />
<src path="${testsrc.dir}" />
<classpath refid="build.classpath" />
</javac>
</target>


<target name="dist" depends="compile"
description="generate the distribution">
<!--Build a jar of just the Tinfour classes (without the test classes) -->
<jar jarfile="dist/Tinfour-1.0.jar" basedir="${build}" excludes="tinfour/test/**" >
<manifest>
<attribute name="Built-By" value="${user.name}" />
<attribute name="Specification-Title" value="Tinfour Library Classes" />
<attribute name="Specification-Version" value="1.0" />
</manifest>
</jar>



<!-- Build a jar of the test classes, with the Tinfour Viewer configured as the
main class. Set up the class path so the viewer (or individual test applications)
can be run. -->
<jar jarfile="dist/TinfourViewer-1.0.jar" basedir="${build}">
<fileset dir="src/test/java" includes="tinfour/test/viewer/resources/**" />
<manifest>
<attribute name="Specification-Title" value="Tinfour Bundled with Tests and Viewer Demo" />
<attribute name="Specification-Version" value="1.0" />
<attribute name="Main-Class" value="tinfour.test.viewer.TinfourViewerMain" />
<attribute name="Class-Path" value="Tinfour-1.0.jar ../lib/commons-math3-3.6.1.jar" />
</manifest>
</jar>
</target>

<target name="clean" description="clean up">
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${build}"/>
<delete dir="${dist}"/>
<delete dir="${javadoc.dir}"/>
<delete file="pmd_results.html" />
</target>

<!-- Generate javadocs for current project into ${javadoc.dir} -->
<target name="javadoc" depends="init" description="generate documentation for Java code">
<mkdir dir="${javadoc.dir}"/>
<javadoc sourcepath="${src.dir}" destdir="${javadoc.dir}" classpathref="build.classpath"
windowtitle="Tinfour API" author="false"
/>
</target>


<!-- PMD to run this, you will have to set up the PMD class path first.
this configuration assumes it is in a parallel folder.
<path id="pmd.classpath">
<fileset dir="../pmd-bin-5.4.1/lib">
<include name="*.jar"/>
</fileset>
</path>
<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" classpathref="pmd.classpath"/>
<target name="pmd">
<pmd rulesetfiles="pmd_ruleset.xml" >
<formatter type="net.sourceforge.pmd.renderers.HTMLRenderer" toFile="pmd_results.html"/>
<fileset dir="${src.dir}">
<include name="**/*.java" />
</fileset>
<fileset dir="${testsrc.dir}">
<include name="**/*.java" />
</fileset>
</pmd>
</target>
-->

</project>
Binary file not shown.
@@ -0,0 +1,31 @@
<?xml version="1.0"?>
<ruleset name="customruleset">
<description>
Rulesets currently honored by Tinfour.
</description>
<rule ref="rulesets/java/basic.xml"/>
<rule ref="rulesets/java/sunsecure.xml"/>
<rule ref="rulesets/java/braces.xml"/>
<rule ref="rulesets/java/imports.xml"/>
<rule ref="rulesets/java/design.xml">
<exclude name="UseVarargs" />
<exclude name="GodClass" />
<exclude name="FieldDeclarationsShouldBeAtStartOfClass" />
</rule>
<!-- TODO: Revisit optimitization rules, right now a lot of violations.
Try this when you have time to test whether they actually matter
by using the TwinBuildTest. I suspect all the "could be final" rules
are resolved by the compiler anyway. -->
<rule ref="rulesets/java/optimizations.xml">
<exclude name="LocalVariableCouldBeFinal" />
<exclude name="MethodArgumentCouldBeFinal" />
<exclude name="PrematureDeclaration" />
</rule>


<rule ref="rulesets/java/unusedcode.xml">
<exclude name="UnusedModifier" />
</rule>

</ruleset>

@@ -0,0 +1 @@
java -Xmx2000m -jar dist/TinfourViewer-1.0.jar

0 comments on commit 31903df

Please sign in to comment.
You can’t perform that action at this time.