Initial commit

This commit is contained in:
Thomas Forgione 2023-02-17 15:56:24 +01:00
commit e743eeb2a5
7 changed files with 63 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/target

7
Cargo.lock generated Normal file
View File

@ -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"

8
Cargo.toml Normal file
View File

@ -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]

11
src/delaunay.rs Normal file
View File

@ -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 }
}
}

2
src/lib.rs Normal file
View File

@ -0,0 +1,2 @@
pub mod mesh;
pub mod delaunay;

14
src/main.rs Normal file
View File

@ -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);
}

20
src/mesh.rs Normal file
View File

@ -0,0 +1,20 @@
use crate::delaunay::Delaunay;
pub struct Point {
pub x: f64,
pub y: f64,
}
pub struct Mesh {
pub points: Vec<Point>,
}
impl Mesh {
pub fn new() -> Mesh {
Mesh { points: vec![] }
}
pub fn delaunay<'a>(&'a self) -> Delaunay<'a> {
Delaunay { mesh: self }
}
}