SDSAI

Simple datastructures and algorithms.

License

License

MIT
GroupId

GroupId

com.github.basking2
ArtifactId

ArtifactId

sdsai-sandbox
Last Version

Last Version

2.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

SDSAI
Simple datastructures and algorithms.
Project URL

Project URL

https://github.com/basking2/sdsai
Source Code Management

Source Code Management

https://github.com/basking2/sdsai.git

Download sdsai-sandbox

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.basking2/sdsai-sandbox/ -->
<dependency>
    <groupId>com.github.basking2</groupId>
    <artifactId>sdsai-sandbox</artifactId>
    <version>2.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.basking2/sdsai-sandbox/
implementation 'com.github.basking2:sdsai-sandbox:2.0.0'
// https://jarcasting.com/artifacts/com.github.basking2/sdsai-sandbox/
implementation ("com.github.basking2:sdsai-sandbox:2.0.0")
'com.github.basking2:sdsai-sandbox:jar:2.0.0'
<dependency org="com.github.basking2" name="sdsai-sandbox" rev="2.0.0">
  <artifact name="sdsai-sandbox" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.basking2', module='sdsai-sandbox', version='2.0.0')
)
libraryDependencies += "com.github.basking2" % "sdsai-sandbox" % "2.0.0"
[com.github.basking2/sdsai-sandbox "2.0.0"]

Dependencies

compile (1)

Group / Artifact Type Version
com.github.basking2 : sdsai-common jar 2.0.0

test (2)

Group / Artifact Type Version
junit : junit jar 4.12
org.slf4j : slf4j-simple jar 1.7.21

Project Modules

There are no modules declared in this project.

sdsai

Homepage

Travis Build Status Coverity Scan

Sam's Data-structures and AI - a collection of Java and Scala utility code.

SDSAI Common

Marching Squares

Marching Squares is an algorithm to take a raster of 1, 0, and -1 values and produce polygons. This implementation can march a single tile or stitch many tiles together into a larger tile. A simple use of this might be

    final byte p = 1;
    final byte n = -1;

    final Tile tile =
            new Tile(new byte[]{
                    0, 0, 0, 0, 0 ,0,
                    0, n, n, n, n, 0,
                    0, n, p, p, n, 0,
                    0, n, p, p, n, 0,
                    0, n, n, n, n, 0,
                    0, 0, 0, 0, 0 ,0,
            }, 6);

    final String geoJson = SimpleGeoJson.write(new VectorTileBuilder(tile, FeatureFactory.uuidProperty()).buildIsoband(), 5, 5);

    try (final OutputStream os = new FileOutputStream("SomeFile.geojson")) {
        os.write(geoJson.getBytes("UTF-8"));
    }

The following image was generated using GeoJson.io on one of the files produced by a unit test for the algorithm implementation.

Marching Squares

Links

Versions

Version
2.0.0