Rename fj::Union to fj::Group

This commit is contained in:
Hanno Braun 2022-03-16 15:28:04 +01:00
parent 1aa0981a73
commit c9f7ee495e
3 changed files with 10 additions and 10 deletions

View File

@ -11,7 +11,7 @@ pub enum Shape3d {
Transform(Box<Transform>), Transform(Box<Transform>),
/// The union of two 3-dimensional shapes /// The union of two 3-dimensional shapes
Union(Box<Union>), Union(Box<Group>),
} }
impl From<Shape3d> for Shape { impl From<Shape3d> for Shape {
@ -114,7 +114,7 @@ impl From<Sweep> for Shape3d {
/// <https://github.com/hannobraun/Fornjot/issues/42> /// <https://github.com/hannobraun/Fornjot/issues/42>
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
#[repr(C)] #[repr(C)]
pub struct Union { pub struct Group {
/// The first of the shapes /// The first of the shapes
pub a: Shape3d, pub a: Shape3d,
@ -122,14 +122,14 @@ pub struct Union {
pub b: Shape3d, pub b: Shape3d,
} }
impl From<Union> for Shape { impl From<Group> for Shape {
fn from(shape: Union) -> Self { fn from(shape: Group) -> Self {
Self::Shape3d(Shape3d::Union(Box::new(shape))) Self::Shape3d(Shape3d::Union(Box::new(shape)))
} }
} }
impl From<Union> for Shape3d { impl From<Group> for Shape3d {
fn from(shape: Union) -> Self { fn from(shape: Group) -> Self {
Self::Union(Box::new(shape)) Self::Union(Box::new(shape))
} }
} }

View File

@ -71,7 +71,7 @@ where
} }
pub trait Union { pub trait Union {
fn union<Other>(&self, other: &Other) -> crate::Union fn union<Other>(&self, other: &Other) -> crate::Group
where where
Other: Clone + Into<crate::Shape3d>; Other: Clone + Into<crate::Shape3d>;
} }
@ -80,13 +80,13 @@ impl<T> Union for T
where where
T: Clone + Into<crate::Shape3d>, T: Clone + Into<crate::Shape3d>,
{ {
fn union<Other>(&self, other: &Other) -> crate::Union fn union<Other>(&self, other: &Other) -> crate::Group
where where
Other: Clone + Into<crate::Shape3d>, Other: Clone + Into<crate::Shape3d>,
{ {
let a = self.clone().into(); let a = self.clone().into();
let b = other.clone().into(); let b = other.clone().into();
crate::Union { a, b } crate::Group { a, b }
} }
} }

View File

@ -15,7 +15,7 @@ use crate::{
use super::ToShape; use super::ToShape;
impl ToShape for fj::Union { impl ToShape for fj::Group {
fn to_shape(&self, tolerance: Scalar, debug_info: &mut DebugInfo) -> Shape { fn to_shape(&self, tolerance: Scalar, debug_info: &mut DebugInfo) -> Shape {
let mut shape = Shape::new(); let mut shape = Shape::new();