Initial commit
This commit is contained in:
commit
e743eeb2a5
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/target
|
7
Cargo.lock
generated
Normal file
7
Cargo.lock
generated
Normal 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
8
Cargo.toml
Normal 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
11
src/delaunay.rs
Normal 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
2
src/lib.rs
Normal file
@ -0,0 +1,2 @@
|
||||
pub mod mesh;
|
||||
pub mod delaunay;
|
14
src/main.rs
Normal file
14
src/main.rs
Normal 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
20
src/mesh.rs
Normal 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 }
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user