Initial commit
此提交包含在:
+11
@@ -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
@@ -0,0 +1,2 @@
|
||||
pub mod mesh;
|
||||
pub mod delaunay;
|
||||
+14
@@ -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
@@ -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 }
|
||||
}
|
||||
}
|
||||
新增問題並參考
封鎖使用者