UTE ( yoot )
ute - engine for matching and manipulating n-sided polygons with tagged sides (in rust)
navigation
[you're here]
this page is a brief how-to-use overview. for detailed examples and faqs, read the wiki
using ute
examples
features
references
using ute
including in your project
[top]
- add this repo* to your
Cargo.toml
:
[dependencies]
ute = {git = "https://github.com/parkcitymedia/ute", branch="main"}
*cargo searches by default for a "master" branch, so branch specification may/may not be necessary.
examples
using handmade or generated tiles
assuming tile path "tile.json
" has been made/exists:
-
map json to a tile (serde)
[top]
use ute::{Tile, identify_tile};
use serde_json::{from_str};
use std::fs::read_to_string;
#[tokio::main] async fn main() -> Result<(), Box<dyn std::error::Error>> {
let raw_tile_path: &str = "tile.json";
let tile_r: String = read_to_string(raw_tile_path).unwrap();
let tile_r: &str = &tile_r;
let mut tile: Tile = from_str(tile_r)?;
tile = identify_tile(&mut tile)?;
println!("my new tile id: {:#?}", tile.tile_id);
Ok(())
}
single tile input
[top]
an example can be found in tiles/tile_example.json
of a handwritten/generated hexagon for data input.
here's an example quad/square to look at right now: quad_example.json
{
"tile_id": "",
"tile_center": "5",
"tile_edges": [
{
"tile_edge": {
"is_open": true,
"name": "top_edge",
"edge_tag": [
{
"tag_position": "0",
"tag_value": "r"
},
{
"tag_position": "1",
"tag_value": "q"
},
{
"tag_position": "2",
"tag_value": "p"
}
]
}
},
{
"tile_edge": {
"is_open": true,
"name": "right_edge",
"edge_tag": [
{
"tag_position": "0",
"tag_value": "o"
},
{
"tag_position": "1",
"tag_value": "n"
},
{
"tag_position": "2",
"tag_value": "m"
}
]
}
},
{
"tile_edge": {
"is_open": true,
"name": "bottom_edge",
"edge_tag": [
{
"tag_position": "0",
"tag_value": "l"
},
{
"tag_position": "1",
"tag_value": "k"
},
{
"tag_position": "2",
"tag_value": "j"
}
]
}
},
{
"tile_edge": {
"is_open": true,
"name": "left_edge",
"edge_tag": [
{
"tag_position": "0",
"tag_value": "c"
},
{
"tag_position": "1",
"tag_value": "b"
},
{
"tag_position": "2",
"tag_value": "a"
}
]
}
}
]
}
features
[top]
references
[top]