mirror of https://github.com/hannobraun/Fornjot
Remove `PartialCurve` getters
This commit is contained in:
parent
00527992ca
commit
6772f0d559
|
@ -29,11 +29,11 @@ impl TransformObject for PartialCurve {
|
|||
objects: &Objects,
|
||||
) -> Result<Self, ValidationError> {
|
||||
let surface = self
|
||||
.surface()
|
||||
.surface
|
||||
.map(|surface| surface.transform(transform, objects))
|
||||
.transpose()?;
|
||||
let global_form = self
|
||||
.global_form()
|
||||
.global_form
|
||||
.map(|global_form| global_form.transform(transform, objects))
|
||||
.transpose()?;
|
||||
|
||||
|
@ -41,7 +41,7 @@ impl TransformObject for PartialCurve {
|
|||
// coordinates, and thus transforming `surface` takes care of it.
|
||||
Ok(Self::default()
|
||||
.with_surface(surface)
|
||||
.with_path(self.path())
|
||||
.with_path(self.path)
|
||||
.with_global_form(global_form))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ impl HalfEdgeBuilder for PartialHalfEdge {
|
|||
.with_global_form(Some(self.extract_global_curve()))
|
||||
.update_as_circle_from_radius(radius);
|
||||
|
||||
let path = curve.path().expect("Expected path that was just created");
|
||||
let path = curve.path.expect("Expected path that was just created");
|
||||
|
||||
let [a_curve, b_curve] =
|
||||
[Scalar::ZERO, Scalar::TAU].map(|coord| Point::from([coord]));
|
||||
|
@ -88,7 +88,7 @@ impl HalfEdgeBuilder for PartialHalfEdge {
|
|||
|
||||
let surface_vertex = SurfaceVertex::partial()
|
||||
.with_position(Some(path.point_from_path_coords(a_curve)))
|
||||
.with_surface(curve.surface())
|
||||
.with_surface(curve.surface.clone())
|
||||
.with_global_form(Some(global_vertex))
|
||||
.build(objects)?
|
||||
.insert(objects)?;
|
||||
|
|
|
@ -57,10 +57,10 @@ impl GlobalVertexBuilder for PartialGlobalVertex {
|
|||
) -> Self {
|
||||
let curve = curve.into().into_partial();
|
||||
|
||||
let path = curve.path().expect(
|
||||
let path = curve.path.expect(
|
||||
"Need path to create `GlobalVertex` from curve and position",
|
||||
);
|
||||
let surface = curve.surface().expect(
|
||||
let surface = curve.surface.expect(
|
||||
"Need surface to create `GlobalVertex` from curve and position",
|
||||
);
|
||||
|
||||
|
|
|
@ -142,7 +142,7 @@ impl MaybePartial<Curve> {
|
|||
pub fn path(&self) -> Option<SurfacePath> {
|
||||
match self {
|
||||
MaybePartial::Full(full) => Some(full.path()),
|
||||
MaybePartial::Partial(partial) => partial.path(),
|
||||
MaybePartial::Partial(partial) => partial.path,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -150,7 +150,7 @@ impl MaybePartial<Curve> {
|
|||
pub fn surface(&self) -> Option<Handle<Surface>> {
|
||||
match self {
|
||||
MaybePartial::Full(full) => Some(full.surface().clone()),
|
||||
MaybePartial::Partial(partial) => partial.surface(),
|
||||
MaybePartial::Partial(partial) => partial.surface.clone(),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -158,7 +158,7 @@ impl MaybePartial<Curve> {
|
|||
pub fn global_form(&self) -> Option<MaybePartial<GlobalCurve>> {
|
||||
match self {
|
||||
Self::Full(full) => Some(full.global_form().clone().into()),
|
||||
Self::Partial(partial) => partial.global_form(),
|
||||
Self::Partial(partial) => partial.global_form.clone(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,21 +22,6 @@ pub struct PartialCurve {
|
|||
}
|
||||
|
||||
impl PartialCurve {
|
||||
/// Access the path that defines the [`Curve`]
|
||||
pub fn path(&self) -> Option<SurfacePath> {
|
||||
self.path
|
||||
}
|
||||
|
||||
/// Access the surface that the [`Curve`] is defined in
|
||||
pub fn surface(&self) -> Option<Handle<Surface>> {
|
||||
self.surface.clone()
|
||||
}
|
||||
|
||||
/// Access the global form of the [`Curve`]
|
||||
pub fn global_form(&self) -> Option<MaybePartial<GlobalCurve>> {
|
||||
self.global_form.clone()
|
||||
}
|
||||
|
||||
/// Provide a path for the partial curve
|
||||
pub fn with_path(mut self, path: Option<SurfacePath>) -> Self {
|
||||
if let Some(path) = path {
|
||||
|
|
Loading…
Reference in New Issue