Skip to content

Commit

Permalink
Layout structure and future work
Browse files Browse the repository at this point in the history
  • Loading branch information
acgetchell committed Dec 20, 2023
1 parent 20227be commit 366dbad
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ uuid = { version = "1.6.1", features = ["v4", "fast-rng", "macro-diagnostics"] }
[lints.rust]
unsafe_code = "forbid"
dead_code = "allow"
missing_docs = "warn"
#missing_docs = "warn"
1 change: 1 addition & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"words": [
"acgetchell",
"CGAL",
"circumsphere",
"clippy",
"codecov",
"Getchell",
Expand Down
29 changes: 25 additions & 4 deletions src/delaunay_core/cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl<T, U, V, const D: usize> Cell<T, U, V, D> {
///
/// # Arguments:
///
/// * `vertices`: The `vertices` parameter is a vector of `Vertex<T, U, D>` objects.
/// * `vertices`: The vertices of the Cell to be constructed.
///
/// # Returns:
///
Expand Down Expand Up @@ -79,8 +79,8 @@ impl<T, U, V, const D: usize> Cell<T, U, V, D> {
///
/// # Arguments:
///
/// * `vertices`: The `vertices` parameter is a vector of `Vertex<T, U, D>` objects.
/// * `data`: The `data` parameter is of type `V`. It represents the data associated with the cell.
/// * `vertices`: The vertices of the Cell to be constructed.
/// * `data`: The data associated with the cell.
///
/// # Returns:
///
Expand Down Expand Up @@ -141,7 +141,7 @@ impl<T, U, V, const D: usize> Cell<T, U, V, D> {
///
/// # Arguments:
///
/// * `vertex`: The `vertex` parameter is of type `Vertex<T, U, D>`.
/// * `vertex`: The vertex to check.
///
/// # Returns:
///
Expand All @@ -167,6 +167,27 @@ impl<T, U, V, const D: usize> Cell<T, U, V, D> {
{
self.vertices.contains(&vertex)
}

/// The function `circumsphere_contains` checks if a given vertex is contained in the circumsphere of the Cell.
///
/// # Arguments:
///
/// * `vertex`: vertex to check.
///
/// # Returns:
///
/// Returns `true` if the given `Vertex` is contained in the circumsphere of the `Cell`, and `false` otherwise.
pub fn circumsphere_contains(&self, vertex: Vertex<T, U, D>) -> bool
where
T: PartialEq,
U: PartialEq,
{
todo!("Implement circumsphere_contains")
}

pub fn is_valid(self) -> bool {
todo!("Implement is_valid for Cell")
}
}

#[cfg(test)]
Expand Down
28 changes: 26 additions & 2 deletions src/delaunay_core/triangulation_data_structure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,19 @@ impl<T, U, V, const D: usize> Tds<T, U, V, D> {
///
/// # Arguments:
///
/// * `points`: A vector of points.
/// * `points`: A vector of points with which to initialize the triangulation.
///
/// # Returns:
///
/// The `new` function returns a Tds.
/// A delaunay triangulation with cells and neighbors aligned, and vertices associated with cells.
pub fn new(points: Vec<Point<T, D>>) -> Self {
// handle case where vertices are constructed with data
let vertices = Vertex::into_hashmap(Vertex::from_points(points));
// let cells_vec = bowyer_watson(vertices);
// assign_neighbors(cells_vec);
// assign_incident_cells(vertices);

// Put cells_vec into hashmap
let cells = HashMap::new();
Self { vertices, cells }
}
Expand Down Expand Up @@ -133,6 +139,24 @@ impl<T, U, V, const D: usize> Tds<T, U, V, D> {
pub fn number_of_cells(&self) -> usize {
self.cells.len()
}

fn bowyer_watson(
&mut self,
vertices: Vec<Vertex<T, U, D>>,
) -> Result<Vec<Cell<T, U, V, D>>, &'static str> {
todo!("Bowyer-Watson algorithm")
}

fn assign_neighbors(&mut self, cells: Vec<Cell<T, U, V, D>>) -> Result<(), &'static str> {
todo!("Assign neighbors")
}

fn assign_incident_cells(
&mut self,
vertices: Vec<Vertex<T, U, D>>,
) -> Result<(), &'static str> {
todo!("Assign incident cells")
}
}

/// The function "start" will eventually return a triangulation data structure.
Expand Down
4 changes: 4 additions & 0 deletions src/delaunay_core/vertex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ impl<T, U, const D: usize> Vertex<T, U, D> {
pub fn dim(&self) -> usize {
D
}

pub fn is_valid(self) -> bool {
todo!("Implement is_valid for Vertex")
}
}
#[cfg(test)]
mod tests {
Expand Down

0 comments on commit 366dbad

Please sign in to comment.