commit e743eeb2a575d633fc8ef6fe425bb06cb6915c8e Author: Thomas Forgione Date: Fri Feb 17 15:56:24 2023 +0100 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..7059a83 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "tmp2" +version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..af8864a --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "tmp2" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/src/delaunay.rs b/src/delaunay.rs new file mode 100644 index 0000000..0c9f9d7 --- /dev/null +++ b/src/delaunay.rs @@ -0,0 +1,11 @@ +use crate::mesh::Mesh; + +pub struct Delaunay<'a> { + pub mesh: &'a Mesh, +} + +impl<'a> Delaunay<'a> { + pub fn from_mesh(mesh: &'a Mesh) -> Delaunay<'a> { + Delaunay { mesh } + } +} diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..5bb3e2f --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,2 @@ +pub mod mesh; +pub mod delaunay; diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..66ede66 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,14 @@ +use tmp2::delaunay::Delaunay; +use tmp2::mesh::Mesh; + +fn make_delaunay<'a>() -> Delaunay<'a> { + let mesh = Mesh::new(); + let delaunay = Delaunay::from_mesh(&mesh); + delaunay +} + +fn main() { + let mesh = Mesh::new(); + let delaunay = mesh.delaunay(); + let delaunay2 = Delaunay::from_mesh(&mesh); +} diff --git a/src/mesh.rs b/src/mesh.rs new file mode 100644 index 0000000..9672a78 --- /dev/null +++ b/src/mesh.rs @@ -0,0 +1,20 @@ +use crate::delaunay::Delaunay; + +pub struct Point { + pub x: f64, + pub y: f64, +} + +pub struct Mesh { + pub points: Vec, +} + +impl Mesh { + pub fn new() -> Mesh { + Mesh { points: vec![] } + } + + pub fn delaunay<'a>(&'a self) -> Delaunay<'a> { + Delaunay { mesh: self } + } +}