Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
gwlucastrig committed Jun 5, 2016
0 parents commit 31903df
Show file tree
Hide file tree
Showing 129 changed files with 33,676 additions and 0 deletions.
14 changes: 14 additions & 0 deletions LICENSE.txt
Original file line number Original file line Diff line number Diff line change
@@ -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.

24 changes: 24 additions & 0 deletions NOTICE.txt
Original file line number Original file line Diff line number Diff line change
@@ -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 changes: 105 additions & 0 deletions README.md
Original file line number Original file line Diff line number Diff line change
@@ -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 changes: 105 additions & 0 deletions build.xml
Original file line number Original file line Diff line number Diff line change
@@ -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 added doc/TinfourAlgorithmsAndDataElements.pdf
Binary file not shown.
31 changes: 31 additions & 0 deletions pmd_ruleset.xml
Original file line number Original file line Diff line number Diff line change
@@ -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>

1 change: 1 addition & 0 deletions run.bat
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1 @@
java -Xmx2000m -jar dist/TinfourViewer-1.0.jar
Loading

0 comments on commit 31903df

Please sign in to comment.