All Projects → zntfdr → Sight

zntfdr / Sight

Licence: MIT license
A spatial search μlibrary powered by GameplayKit 👾

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Sight

Mathnet Spatial
Math.NET Spatial
Stars: ✭ 246 (+811.11%)
Mutual labels:  spatial, 2d
Spatial.Engine
[WIP] Spatial is a cross-platform C++ game engine.
Stars: ✭ 50 (+85.19%)
Mutual labels:  spatial
pygeopackage
A Python package to read/write spatial data to a geopackage.
Stars: ✭ 33 (+22.22%)
Mutual labels:  spatial
tic-tac-toe
🕹 iOS game - classic Tic Tac Toe with AI and state machines [Swift + SpriteKit + GameplayKit].
Stars: ✭ 60 (+122.22%)
Mutual labels:  gameplaykit
zfrag
Zen Game in which you can manually defrag a virtual Hard Disk, Made with Unity.
Stars: ✭ 86 (+218.52%)
Mutual labels:  2d
binocle-unity
Binocle is a simple 2D code-based framework for Unity
Stars: ✭ 23 (-14.81%)
Mutual labels:  2d
drawingwithcode
Drawing with code 😘
Stars: ✭ 28 (+3.7%)
Mutual labels:  2d
CutAndDisplace
Boundary Element MATLAB code. Modelling faults and deformation
Stars: ✭ 40 (+48.15%)
Mutual labels:  2d
geostan
Bayesian spatial analysis
Stars: ✭ 40 (+48.15%)
Mutual labels:  spatial
xr-kit-samples-unity
Magicverse SDK sample project
Stars: ✭ 26 (-3.7%)
Mutual labels:  spatial
AOI
An R 📦 to find, process, and describe "areas of interest"
Stars: ✭ 27 (+0%)
Mutual labels:  spatial
wkb-parser
Well-known binary (WKB) Parser.
Stars: ✭ 69 (+155.56%)
Mutual labels:  spatial
sdf-2d
A graphics library to enable the real-time rendering of 2D signed distance fields on the web.
Stars: ✭ 70 (+159.26%)
Mutual labels:  2d
m1-web-spatialaudioplayer
Consolidated Mach1 spatial audio player focused on collecting all headtracking input methods and defining best practices
Stars: ✭ 26 (-3.7%)
Mutual labels:  spatial
calcite-maps-styler-template
An ArcGIS configurable application for creating, styling and sharing modern 2D and 3D map apps. Built with ArcGIS for Javascript API v4, Calcite Maps and Bootstrap.
Stars: ✭ 29 (+7.41%)
Mutual labels:  2d
MonoGame.Primitives2D
Easy-to-use 2D primitives
Stars: ✭ 44 (+62.96%)
Mutual labels:  2d
de9im
DE-9IM spatial predicate library implemented in Javascript.
Stars: ✭ 22 (-18.52%)
Mutual labels:  spatial
cleangeo
Cleaning geometries from spatial objects in R
Stars: ✭ 43 (+59.26%)
Mutual labels:  spatial
SNKRX
A replayable arcade shooter where you control a snake of heroes.
Stars: ✭ 1,067 (+3851.85%)
Mutual labels:  2d
agrid
A grid for modelling, analyse, map and visualise multidimensional and multivariate data
Stars: ✭ 16 (-40.74%)
Mutual labels:  spatial

Sight

Build status Swift Package Manager MacOS + iOS + iPadOS + tvOS Twitter: @zntfdr

Welcome to Sight, a Swift spatial search μlibrary. Its primary goal is to extend Apple's GameplayKit framework.

Usage

Sight helps you quickly determine which object is closest to a given position.

This is done via a Region instance, which represents the space where all the objects are positioned in.

import Sight

// Define a region with bounds and search radius.
let region = Region<String>(
  minBounds: SIMD2(x: 0, y: 0), 
  maxBounds: SIMD2(x: 1, y: 1), 
  searchRadius: 0.3
)

// Place objects in the region.
region.add("A", at: SIMD2(x: 0, y: 0.1))
region.add("B", at: SIMD2(x: 0.5, y: 0))
region.add("C", at: SIMD2(x: 0, y: 0.8))

// Find the closest object to any position.
region.closestValue(to: SIMD2(x: 0.5, y: 0.2)) // "B" 
region.closestValue(to: SIMD2(x: 1, y: 0)) // nil 

Region is optimized for spatial searches, this is why during its initialization both search radius and its bounds are required.

You can find many more examples in the Tests folder.

Installation

Sight is distributed using the Swift Package Manager. To install it into a project, follow this tutorial and use this repository URL: https://github.com/zntfdr/Sight.git.

Credits

Sight was built by Federico Zanetello as a component of Bangkok Metro.

If you'd like to know more on how this library works, please refer to GameplayKit's GKQuadtree overview.

Contributions and Support

All users are welcome and encouraged to become active participants in the project continued development — by fixing any bug that they encounter, or by improving the documentation wherever it’s found to be lacking.

If you'd like to make a change, please open a Pull Request, even if it just contains a draft of the changes you’re planning, or a test that reproduces an issue.

Thank you and please enjoy using Sight!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].