Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused parts of Shape API #730

Merged
merged 5 commits into from
Jun 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 9 additions & 49 deletions crates/fj-kernel/src/shape/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::objects::{Curve, Cycle, Edge, Face, Surface, Vertex};

use super::{
stores::{Store, Stores},
Handle, Iter, Mapping, Object, Update,
Handle, Iter, Object, Update,
};

/// The boundary representation of a shape
Expand Down Expand Up @@ -116,36 +116,32 @@ impl Shape {
///
/// This is done recursively.
pub fn merge<T: Object>(&mut self, object: T) -> Handle<T> {
object.merge_into(None, self, &mut Mapping::new())
object.merge_into(self)
}

/// Merge the provided shape into this one
///
/// Returns a [`Mapping`] that maps each object from the merged shape to the
/// merged objects in this shape.
pub fn merge_shape(&mut self, other: &Shape) -> Mapping {
let mut mapping = Mapping::new();

pub fn merge_shape(&mut self, other: &Shape) {
for object in other.curves() {
object.get().merge_into(Some(object), self, &mut mapping);
object.get().merge_into(self);
}
for object in other.surfaces() {
object.get().merge_into(Some(object), self, &mut mapping);
object.get().merge_into(self);
}
for object in other.vertices() {
object.get().merge_into(Some(object), self, &mut mapping);
object.get().merge_into(self);
}
for object in other.edges() {
object.get().merge_into(Some(object), self, &mut mapping);
object.get().merge_into(self);
}
for object in other.cycles() {
object.get().merge_into(Some(object), self, &mut mapping);
object.get().merge_into(self);
}
for object in other.faces() {
object.get().merge_into(Some(object), self, &mut mapping);
object.get().merge_into(self);
}

mapping
}

/// Update objects in the shape
Expand All @@ -156,42 +152,6 @@ impl Shape {
Update::new(&mut self.stores)
}

/// Clone the shape
///
/// Returns a [`Mapping`] that maps each object from the original shape to
/// the respective object in the cloned shape.
pub fn clone_shape(&self) -> (Shape, Mapping) {
let mut target = Shape::new();
let mut mapping = Mapping::new();

for original in self.curves() {
let cloned = target.merge(original.get());
mapping.curves.insert(original, cloned);
}
for original in self.surfaces() {
let cloned = target.merge(original.get());
mapping.surfaces.insert(original, cloned);
}
for original in self.vertices() {
let cloned = target.merge(original.get());
mapping.vertices.insert(original, cloned);
}
for original in self.edges() {
let cloned = target.merge(original.get());
mapping.edges.insert(original, cloned);
}
for original in self.cycles() {
let cloned = target.merge(original.get());
mapping.cycles.insert(original, cloned);
}
for original in self.faces() {
let cloned = target.merge(original.get());
mapping.faces.insert(original, cloned);
}

(target, mapping)
}

/// Access an iterator over all curves
///
/// The caller must not make any assumptions about the order of curves.
Expand Down
102 changes: 0 additions & 102 deletions crates/fj-kernel/src/shape/mapping.rs

This file was deleted.

2 changes: 0 additions & 2 deletions crates/fj-kernel/src/shape/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@

mod api;
mod local;
mod mapping;
mod object;
mod stores;
mod update;

pub use self::{
api::Shape,
local::LocalForm,
mapping::Mapping,
object::Object,
stores::{Handle, Iter},
update::Update,
Expand Down
Loading