Initial commit
This commit is contained in:
commit
e743eeb2a5
|
@ -0,0 +1 @@
|
|||
/target
|
|
@ -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"
|
|
@ -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]
|
|
@ -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 }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
pub mod mesh;
|
||||
pub mod delaunay;
|
|
@ -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);
|
||||
}
|
|
@ -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…
Reference in New Issue