Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Fiday committed Oct 29, 2021
0 parents commit eb3a5ad
Show file tree
Hide file tree
Showing 61 changed files with 122,469 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry exported="true" kind="lib" path="lib/guava-12.0.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bin
*.png
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

124 changes: 124 additions & 0 deletions .idea/uiDesigner.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>delaunay</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
12 changes: 12 additions & 0 deletions .settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#Thu May 31 15:48:35 GST 2012
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.5
Binary file added FidiStuff.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added IMG_8154.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Copyright 2012 Bill Dwyer

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.

52 changes: 52 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
delaunay
========

Delaunay Triangulation for Java with Hilbert Curve linearization and a Delaunay Tesselation Field Estimator (DTFE)

### Four line demo ###
```Java
public static void fourLiner() throws Exception {
Triangulation t = new Triangulation();
t.addAllVertices(Triangulations.randomVertices(1000, 400, 400));
t.triangulate();
Demo.drawTriangulation(t, 400, 400, "triangulation.png");
}
```

### Delaunay Triangulation ###
The `Triangulation` class creates a Delaunay Triangulation of the Vertexs. (http://en.wikipedia.org/wiki/Delaunay_triangulation)

This implementation uses a simple iterative approach, but with some pre-processing
to make the real-world performance fast.

1. For each vertex, we walk to the enclosing triangle.
2. We create a cavity from that triangle and all neighboring triangles for which the vertex is
in its circumcircle.
3. We create new triangles between the edges of the cavity and the
vertex.

The basic incremental triangulation method inspired by Paul Bourke's notes
and psuedocode. See: (http://paulbourke.net/papers/triangulate/).

### Performance Characteristics ###
Prior to triangulation, the vertices are sorted using a Hilbert Space-Filling curve (http://en.wikipedia.org/wiki/Hilbert_curve). Since
our locate method walks the triangulation, linearizing the points with a
space-filling curve gives us some pretty good locality when adding each
vertex, thus greatly reducing the number of hops required to locate the
vertex. The sort is O(n log n), but is fast since hilbert indices are
computed in O(h) (where h is a small constant), and results in a
triangulation asymptotic running time of O(n) for non-diabolical cases.

### Delaunay Tessellation Field Estimator ###
The `DtfeTriangulationMap` class performs the **Delaunay Tessellation Field Estimator** (DTFE) (http://en.wikipedia.org/wiki/Delaunay_tessellation_field_estimator) in two dimensions, which enables the reconstruction of the continuous density field from a set of points.

The DTFE is simple to understand:

1. Construct a triangulation of the points.
2. For each vertex, compute its density with the formula: density = point_mass / sum_of_area_of_neighboring_triangles
3. To reconstruct the continuous field, interpolate the density using the vertex densities.

There are several methods for interpolation, which are included in the `InterpolationStrategies` class.

For more info and **PICTURES!** check out this wiki page:
(https://github.com/themadcreator/delaunay/wiki/DTFE-Interpolation-Strategies)
59 changes: 59 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project default="build-cleanup" name="Create distributable jar">
<!-- build input -->
<property name="main.class" value="org.delaunay.Demo" />
<property name="src.dir" value="${basedir}/src" />
<property name="lib.dir" value="${basedir}/lib" />

<!-- build output -->
<property name="dist.dir" value="${basedir}/dist" />
<property name="build.dir" value="${basedir}/build" />

<target name="clean">
<delete dir="${dist.dir}" failonerror="false" />
<delete dir="${build.dir}" failonerror="false" />
</target>

<target name="compile" depends="clean">
<mkdir dir="${build.dir}" />
<javac destdir="${build.dir}">
<src path="${src.dir}" />
<classpath>
<fileset dir="${lib.dir}" includes="**/*.jar" />
</classpath>
</javac>
</target>

<target name="unjar_deps" depends="compile">
<unzip dest="${build.dir}">
<fileset dir="${lib.dir}">
<include name="**/*.jar" />
</fileset>
</unzip>
</target>

<target name="copy_deps" depends="compile">
<mkdir dir="${dist.dir}" />
<copy todir="${dist.dir}">
<fileset dir="${lib.dir}">
<include name="**/*.jar" />
</fileset>
</copy>
</target>

<target name="build" depends="compile,copy_deps">
<mkdir dir="${dist.dir}" />
<jar destfile="${dist.dir}/delaunay.jar" duplicate="preserve">
<manifest>
<attribute name="Main-Class" value="${main.class}" />
<attribute name="Class-Path" value="." />
</manifest>
<fileset dir="${build.dir}" />
<fileset dir="${src.dir}" includes="**/*.java"/>
</jar>
</target>

<target name="build-cleanup" depends="build">
<delete dir="${build.dir}" failonerror="false" />
</target>
</project>
27 changes: 27 additions & 0 deletions delaunay.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="EclipseModuleManager">
<libelement value="jar://$MODULE_DIR$/lib/guava-12.0.jar!/" />
<src_description expected_position="0">
<src_folder value="file://$MODULE_DIR$/src" expected_position="0" />
</src_description>
</component>
<component name="NewModuleRootManager">
<output url="file://$MODULE_DIR$/bin" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="inheritedJdk" />
<orderEntry type="module-library" exported="">
<library name="guava-12.0.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/guava-12.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
</component>
</module>
Binary file added dist/delaunay.jar
Binary file not shown.
Binary file added dist/guava-12.0.jar
Binary file not shown.
Binary file added dnd.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added happyDog.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added lib/guava-12.0.jar
Binary file not shown.
Loading

0 comments on commit eb3a5ad

Please sign in to comment.