-
-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1026 from hannobraun/sweep
Start cleaning up sweep algorithm
- Loading branch information
Showing
5 changed files
with
89 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
use crate::objects::{Curve, GlobalCurve, Surface, SweptCurve}; | ||
|
||
use super::Sweep; | ||
|
||
impl Sweep for Curve { | ||
type Swept = Surface; | ||
|
||
fn sweep( | ||
self, | ||
path: impl Into<super::Path>, | ||
tolerance: impl Into<crate::algorithms::approx::Tolerance>, | ||
color: fj_interop::mesh::Color, | ||
) -> Self::Swept { | ||
self.global().sweep(path, tolerance, color) | ||
} | ||
} | ||
|
||
impl Sweep for GlobalCurve { | ||
type Swept = Surface; | ||
|
||
fn sweep( | ||
self, | ||
path: impl Into<super::Path>, | ||
_: impl Into<crate::algorithms::approx::Tolerance>, | ||
_: fj_interop::mesh::Color, | ||
) -> Self::Swept { | ||
Surface::SweptCurve(SweptCurve { | ||
curve: *self.kind(), | ||
path: path.into().inner(), | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
use fj_interop::mesh::Color; | ||
|
||
use crate::{ | ||
algorithms::approx::Tolerance, | ||
objects::{GlobalCurve, GlobalEdge, GlobalVertex, VerticesOfEdge}, | ||
}; | ||
|
||
use super::{Path, Sweep}; | ||
|
||
impl Sweep for GlobalVertex { | ||
type Swept = GlobalEdge; | ||
|
||
fn sweep( | ||
self, | ||
path: impl Into<Path>, | ||
_: impl Into<Tolerance>, | ||
_: Color, | ||
) -> Self::Swept { | ||
let a = self; | ||
let b = | ||
GlobalVertex::from_position(self.position() + path.into().inner()); | ||
|
||
let curve = | ||
GlobalCurve::build().line_from_points([a.position(), b.position()]); | ||
|
||
GlobalEdge::new(curve, VerticesOfEdge::from_vertices([a, b])) | ||
} | ||
} |