diff --git a/fj/src/shape_3d.rs b/fj/src/shape_3d.rs index 27397d96f..afdd45dc8 100644 --- a/fj/src/shape_3d.rs +++ b/fj/src/shape_3d.rs @@ -20,6 +20,36 @@ impl From for Shape { } } +/// A group of two 3-dimensional shapes +/// +/// A group is a collection of disjoint shapes. It is not a union, in that the +/// shapes in the group are not allowed to touch or overlap. +/// +/// # Limitations +/// +/// Whether the shapes in the group touch or overlap is not currently checked. +#[derive(Clone, Debug)] +#[repr(C)] +pub struct Group { + /// The first of the shapes + pub a: Shape3d, + + /// The second of the shapes + pub b: Shape3d, +} + +impl From for Shape { + fn from(shape: Group) -> Self { + Self::Shape3d(Shape3d::Union(Box::new(shape))) + } +} + +impl From for Shape3d { + fn from(shape: Group) -> Self { + Self::Union(Box::new(shape)) + } +} + /// A transformed 3-dimensional shape /// /// # Limitations @@ -97,33 +127,3 @@ impl From for Shape3d { Self::Sweep(shape) } } - -/// A group of two 3-dimensional shapes -/// -/// A group is a collection of disjoint shapes. It is not a union, in that the -/// shapes in the group are not allowed to touch or overlap. -/// -/// # Limitations -/// -/// Whether the shapes in the group touch or overlap is not currently checked. -#[derive(Clone, Debug)] -#[repr(C)] -pub struct Group { - /// The first of the shapes - pub a: Shape3d, - - /// The second of the shapes - pub b: Shape3d, -} - -impl From for Shape { - fn from(shape: Group) -> Self { - Self::Shape3d(Shape3d::Union(Box::new(shape))) - } -} - -impl From for Shape3d { - fn from(shape: Group) -> Self { - Self::Union(Box::new(shape)) - } -}