Skip to content

Commit

Permalink
Merge pull request #2403 from hannobraun/reverse
Browse files Browse the repository at this point in the history
Remove unused code from `reverse` module
  • Loading branch information
hannobraun authored Jun 27, 2024
2 parents 5595e3b + 6ea36b0 commit 97ab25c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 67 deletions.
23 changes: 2 additions & 21 deletions crates/fj-core/src/operations/reverse/cycle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ use crate::{
operations::{
derive::DeriveFrom, geometry::UpdateHalfEdgeGeometry, insert::Insert,
},
storage::Handle,
topology::{Cycle, HalfEdge, Surface},
topology::{Cycle, HalfEdge},
Core,
};

use super::{Reverse, ReverseCurveCoordinateSystems};
use super::Reverse;

impl Reverse for Cycle {
fn reverse(&self, core: &mut Core) -> Self {
Expand All @@ -33,21 +32,3 @@ impl Reverse for Cycle {
Cycle::new(edges)
}
}

impl ReverseCurveCoordinateSystems for (&Cycle, &Handle<Surface>) {
type Reversed = Cycle;

fn reverse_curve_coordinate_systems(
self,
core: &mut Core,
) -> Self::Reversed {
let (cycle, surface) = self;

let edges = cycle
.half_edges()
.iter()
.map(|edge| (edge, surface).reverse_curve_coordinate_systems(core));

Cycle::new(edges)
}
}
19 changes: 2 additions & 17 deletions crates/fj-core/src/operations/reverse/face.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{borrow::Borrow, ops::Deref};
use std::borrow::Borrow;

use crate::{
operations::{
Expand All @@ -10,7 +10,7 @@ use crate::{
Core,
};

use super::{Reverse, ReverseCurveCoordinateSystems};
use super::Reverse;

impl Reverse for Face {
fn reverse(&self, core: &mut Core) -> Self {
Expand Down Expand Up @@ -41,18 +41,3 @@ impl<const D: usize> Reverse for Polygon<D, IsInsertedYes> {
self.replace_face(face)
}
}

impl ReverseCurveCoordinateSystems for &Face {
type Reversed = Face;

fn reverse_curve_coordinate_systems(
self,
core: &mut Core,
) -> Self::Reversed {
let region = (self.region().deref(), self.surface())
.reverse_curve_coordinate_systems(core)
.insert(core)
.derive_from(self.region(), core);
Face::new(self.surface().clone(), region)
}
}
31 changes: 2 additions & 29 deletions crates/fj-core/src/operations/reverse/region.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
use std::ops::Deref;

use crate::{
operations::{derive::DeriveFrom, insert::Insert},
storage::Handle,
topology::{Region, Surface},
topology::Region,
Core,
};

use super::{Reverse, ReverseCurveCoordinateSystems};
use super::Reverse;

impl Reverse for Region {
fn reverse(&self, core: &mut Core) -> Self {
Expand All @@ -23,27 +20,3 @@ impl Reverse for Region {
Region::new(exterior, interiors)
}
}

impl ReverseCurveCoordinateSystems for (&Region, &Handle<Surface>) {
type Reversed = Region;

fn reverse_curve_coordinate_systems(
self,
core: &mut Core,
) -> Self::Reversed {
let (region, surface) = self;

let exterior = (region.exterior().deref(), surface)
.reverse_curve_coordinate_systems(core)
.insert(core)
.derive_from(region.exterior(), core);
let interiors = region.interiors().iter().map(|cycle| {
(cycle.deref(), surface)
.reverse_curve_coordinate_systems(core)
.insert(core)
.derive_from(cycle, core)
});

Region::new(exterior, interiors)
}
}

0 comments on commit 97ab25c

Please sign in to comment.