Skip to content

Commit

Permalink
The first revision
Browse files Browse the repository at this point in the history
  • Loading branch information
habedi committed Feb 8, 2025
1 parent 9f0b42f commit 9b4c011
Show file tree
Hide file tree
Showing 18 changed files with 1,140 additions and 690 deletions.
134 changes: 0 additions & 134 deletions .github/workflows/release.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,4 @@ octree.dot
quadtree.dot
rtree_2d.dot
rtree_3d.dot
main.rs
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "spart"
version = "0.1.0"
version = "0.1.1"
description = "A collection of space partitioning tree data structures for Rust."
repository = "https://github.com/habedi/spart"
license = "MIT OR Apache-2.0"
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
PKG = github.com/habedi/spart
BINARY_NAME = $(or $(PROJ_BINARY), $(notdir $(PKG)))
BINARY = target/release/$(BINARY_NAME)
DEBUG_SPART = 0
PATH := /snap/bin:$(PATH)
CARGO_TERM_COLOR = always
DEBUG_SPART = 0

# Default target
.DEFAULT_GOAL := help
Expand Down
26 changes: 14 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,30 @@
[<img alt="Docs" src="https://img.shields.io/badge/docs-latest-3776ab?style=for-the-badge&labelColor=555555&logo=readthedocs" height="20">](docs)
[<img alt="License" src="https://img.shields.io/badge/license-MIT%2FApache--2.0-007ec6?style=for-the-badge&labelColor=555555&logo=open-source-initiative" height="20">](https://github.com/habedi/spart)

Spart (**s**[pace] **par**[titioning] **t**[rees] is a Rust library that includes implementations of various
space partitioning tree data structures for indexing and querying point data in 2D and 3D spaces.
Spart (**s**[pace] **par**[titioning] **t**[rees] is a Rust library that provides implementations of various
space partitioning tree data structures for efficient indexing and searching 2D and 3D point data.

Currently, the following trees are implemented:

| Index | Tree Type | 2D | 3D | kNN query | Range query |
|-------|----------------------------------------------------|----|----|-----------|-------------|
| 1 | [Quadtree](https://en.wikipedia.org/wiki/Quadtree) || |||
| 2 | [Octree](https://en.wikipedia.org/wiki/Octree) | ||||
| 3 | [Kd-tree](https://en.wikipedia.org/wiki/K-d_tree) |||||
| 4 | [R-tree](https://en.wikipedia.org/wiki/R-tree) |||||
| 5 | [BSP-tree](https://en.wikipedia.org/wiki/BSP-tree) |||||
| Index | Tree Type | 2D | 3D | kNN search | Range search |
|-------|----------------------------------------------------|----|----|------------|--------------|
| 1 | [Quadtree](https://en.wikipedia.org/wiki/Quadtree) || | | |
| 2 | [Octree](https://en.wikipedia.org/wiki/Octree) | || | |
| 3 | [Kd-tree](https://en.wikipedia.org/wiki/K-d_tree) ||| | |
| 4 | [R-tree](https://en.wikipedia.org/wiki/R-tree) ||| | |
| 5 | [BSP-tree](https://en.wikipedia.org/wiki/BSP-tree) ||| | |

*Version requirement: Spart supports rustc 1.83 and newer.*
## Installation

[Release notes](https://github.com/habedi/spart/releases)
```bash
cargo add spart
```

## Documentation

The documentation for the latest release can be found [here](docs).

Check out the [tests](tests/) directory for examples on how to use the library.
Additionally, check out the [tests](tests/) directory for detailed examples for how to use the library.

## Contributing

Expand Down
6 changes: 3 additions & 3 deletions benches/knn_bench.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use criterion::{black_box, criterion_group, criterion_main, Criterion};
mod utils;
use spart::bsp_tree::{BSPTreeObject, Point2DBSP, Point3DBSP};
use spart::bsp_tree::{Point2DBSP, Point3DBSP};
use spart::geometry::{Point2D, Point3D, Rectangle};
use spart::{bsp_tree, kd_tree, octree, quadtree, r_tree};
use tracing::info;
Expand Down Expand Up @@ -62,7 +62,7 @@ fn benchmark_knn_bsptree_2d(_c: &mut Criterion) {
cc.bench_function("knn_bsptree_2d", |b| {
b.iter(|| {
info!("Running knn search on 2D BSPTree");
let res = tree.knn_search(&target.mbr(), BENCH_KNN_SIZE);
let res = tree.knn_search(&target, BENCH_KNN_SIZE);
info!("Completed knn search on 2D BSPTree");
black_box(res)
})
Expand Down Expand Up @@ -146,7 +146,7 @@ fn benchmark_knn_bsptree_3d(_c: &mut Criterion) {
cc.bench_function("knn_bsptree_3d", |b| {
b.iter(|| {
info!("Running knn search on 3D BSPTree");
let res = tree.knn_search(&target.mbr(), BENCH_KNN_SIZE);
let res = tree.knn_search(&target, BENCH_KNN_SIZE);
info!("Completed knn search on 3D BSPTree");
black_box(res)
})
Expand Down
Loading

0 comments on commit 9b4c011

Please sign in to comment.