• Stars
    star
    131
  • Rank 271,307 (Top 6 %)
  • Language
    Go
  • License
    MIT License
  • Created almost 8 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

📌 State of the art point location and neighbour finding algorithms for region quadtrees, in Go

Region quadtrees in Go

Build Status Coverage Status Go Report Card GoDoc

Region quadtrees and efficient neighbour finding techniques in Go

Go-rquad proposes various implementations of region quadtrees.

A region quadtree is a special kind of quadtree that recursively subdivides a 2 dimensional space into 4 smaller and generally equal rectangular regions, until the wanted quadtree resolution has been reached, or no further subdivisions can be performed.

Region quadtrees can be used for image processing; in this case a leaf node represents a rectangular region of an image in which all colors are equal or the color difference is under a given threshold.

Region quadtrees may also be used to represent data fields with variable resolution. For example, the temperatures in an area may be stored as a quadtree where each leaf node stores the average temperature over the subregion it represents.

In this package, quadtrees implement the imgscan.Scanner interface, this provides a way to scan (i.e extract) the pixels in order to perform the subdivisions.

API Overview

Node interface

type Node interface {
        Parent() Node
        Child(Quadrant) Node
        Bounds() image.Rectangle
        Color() Color
        Location() Quadrant
}

Quadtree interface

A Quadtree represents a hierarchical collection of Nodes, its API is simple: access to the root Node and a way to iterate over all the leaves.

type Quadtree interface {
        ForEachLeaf(Color, func(Node))
        Root() Node
}

Functions

Locate returns the leaf node of q that contains pt, or nil if q doesn't contain pt.

func Locate(q Quadtree, pt image.Point) Node

ForEachNeighbour calls fn for each neighbour of n.

func ForEachNeighbour(n Node, fn func(Node))

Basic implementation: BasicTree and basicNode

BasicTree is in many ways the standard implementation of Quadtree, it just does the job.

State of the art implementation: CNTree and CNNode

CNTree or Cardinal Neighbour Quadtree implements state of the art techniques:

  • from any given leaf node, its neighbours (of any size) are accessed in constant time 0(1) as they implement the Cardinal Neighbour Quadtree technique (cf Safwan Qasem 2015). The time complexity reduction is obtained through the addition of only four pointers per leaf node in the quadtree.
  • fast point location queries (locating which leaf node contains a specific point), thanks to the binary branching method (cf Frisken Perry 2002). This simple and efficient method is nonrecursive, table free, and reduces the number of comparisons with poor predictive behavior, that are otherwise required with the standard method.

Benchmarks

Quadtree creation benchmark

Neighbour finding benchmark

Point location benchmark

Research papers

  • Bottom-up neighour finding technique. cf Hanan Samet 1981,
    Neighbor Finding Techniques for Images Represented by Quadtrees, paper

  • Cardinal Neighbor Quadtree. cf Safwan Qasem 2015,
    Cardinal Neighbor Quadtree: a New Quadtree-based Structure for Constant-Time Neighbor Finding, paper

  • Fast point location using binary branching method. cf Frisken, Perry 2002
    Simple and Efficient Traversal Methods for Quadtrees and Octrees, paper

License

go-rquad is open source software distributed in accordance with the MIT License, which says:

Copyright (c) 2016 Aurélien Rainone

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

More Repositories

1

statsviz

🚀 Visualise your Go program runtime metrics in real time in the browser
Go
3,128
star
2

gitmux

💻 Git in your tmux status bar
Go
549
star
3

tmux-gitbar

Git in your tmux status bar
Shell
171
star
4

go-detour

👾 Navigation mesh pathfinding and spatial reasoning library
Go
123
star
5

macdeployqtfix

To bundle a Qt application on Mac OSX, there is macdeployqt. To finish the job there is macdeployqtfix! ✅
Python
60
star
6

golq

📡 2D locality queries in Go
Go
31
star
7

assertgo

Conditionally compiled assertions in Go
Go
18
star
8

scripts

this is my collection of bash scripts for everyday use
Shell
15
star
9

dotfiles

My dotfiles config... Feel free to use
Shell
8
star
10

udpnet

Game networking library in Go, based on UDP
Go
6
star
11

gogeo

Geometry library in Go
Go
5
star
12

gitstatus

Retrieve the Git status of a working tree, in Go.
Go
5
star
13

bitfield

Go-generate code to emulate C bit fields
Go
5
star
14

gioexp

Experiments with Gio, the cross-platform gui for Go
Go
3
star
15

evolve

Evolutionary Computation Framework
Go
3
star
16

fastlfu

LFU cache with O(1) runtime complexity for all operations: insertion, access and deletion (eviction). In Go.
Go
3
star
17

imgtools

Utilities for working with images in Go, completing the standard image package.
Go
3
star
18

gotypes

Automatically generate Go code from Go structures
Go
2
star
19

urlserv

URL shortener demo for First Steps with Go training
Go
2
star
20

iolib2

Output device abstraction. Mask device differences (serial port, LPT, file, ethernet, etc.). Extendable
Go
2
star
21

serve

Serves the content of a directory as HTTP.
Go
2
star
22

zsort

Useful additions to the sort package
Go
1
star
23

gencli

Go-generate your urfave/cli flags from a structure
Go
1
star
24

go-gencon

Go Generic Containers - Reduce boilerplate by generating containers for your datastructures
Go
1
star
25

gsettings-upd

A systemd service that updates gsettings values
Go
1
star
26

get-up-and-go

Solutions for exercices of the Tour of Go
Go
1
star
27

training

Firs steps with go (Go introduction training)
Go
1
star
28

bitstring

Go Bitstring module
Go
1
star
29

artificial

Artificial art framework and experiement
Go
1
star
30

beggining-with-go

Go
1
star
31

monitoring

Monitoring workshop source code
Go
1
star
32

math32

32 bits wrapper around the standard go math package
Go
1
star
33

opencog-workbench

A tool to assist in the control and visualization of the OpenCog AtomSpace. It should facilitate the comprehension of AGI dynamics and allow a researcher to guide, tune, and understand the various mind processes in action, handle the parsing of log files and dynamic configuration of a running OpenCog instance. (developed with Angular, Bootstrap)
JavaScript
1
star