pub struct Csg<T: Number> { /* private fields */ }Implementations§
Source§impl<T: Number> Csg<T>
impl<T: Number> Csg<T>
pub fn new(polygons: Vec<Polygon<T, 3>>) -> Self
pub fn from_polygons(polygons: impl IntoIterator<Item = Polygon<T, 3>>) -> Self
pub fn factory(&self) -> &CsgFactory<T>
pub fn factory_mut(&mut self) -> &mut CsgFactory<T>
Sourcepub fn with_factory(self, factory: CsgFactory<T>) -> Self
pub fn with_factory(self, factory: CsgFactory<T>) -> Self
Replace the embedded factory (e.g. after building via an external CsgFactory).
pub fn union(self, other: Csg<T>) -> Self
pub fn intersection(self, other: Csg<T>) -> Self
pub fn polygons(&self) -> &[Polygon<T, 3>]
Sourcepub fn cleanup(self) -> Self
pub fn cleanup(self) -> Self
Run a cleanup pass: remove degenerate polygons, collapse collinear vertices, and merge coplanar adjacent polygons. Call once before mesh generation rather than after every CSG operation.
Sourcepub fn mapv_inplace<F>(&mut self, f: F)
pub fn mapv_inplace<F>(&mut self, f: F)
Apply a function to every polygon in place.
Sourcepub fn par_mapv_inplace<F>(&mut self, f: F)
pub fn par_mapv_inplace<F>(&mut self, f: F)
Apply a function to every polygon in place, in parallel.
Sourcepub fn mapv_inplace_points<F>(&mut self, f: F)
pub fn mapv_inplace_points<F>(&mut self, f: F)
Apply a function to every vertex of every polygon in place.
Sourcepub fn par_mapv_inplace_points<F>(&mut self, f: F)
pub fn par_mapv_inplace_points<F>(&mut self, f: F)
Apply a function to every vertex of every polygon in place, in parallel.
Sourcepub fn scale(self, factors: Vector3<T>) -> Self
pub fn scale(self, factors: Vector3<T>) -> Self
Scale all polygon vertices by per-axis factors.
Planes are recomputed from the scaled vertices: a non-uniform scale changes plane normals (inverse-transpose transform), so the cached plane can’t just be carried over.
Sourcepub fn rotate_euler(self, angles_deg: Vector3<T>) -> Self
pub fn rotate_euler(self, angles_deg: Vector3<T>) -> Self
Rotate all polygons by Euler angles (degrees), applied as Z × Y × X.
Sourcepub fn mirror(self, axes: Vector3<T>) -> Self
pub fn mirror(self, axes: Vector3<T>) -> Self
Mirror across axes where the corresponding component is non-zero.
Reverses polygon winding to maintain correct normals.
Sourcepub fn difference(self, other: Csg<T>) -> Self
pub fn difference(self, other: Csg<T>) -> Self
Different (a - (a ^ b))
Sourcepub fn extrude(
self,
along: Vector3<T>,
transform: Affine3<T>,
slices: usize,
) -> Result<Self, Error>
pub fn extrude( self, along: Vector3<T>, transform: Affine3<T>, slices: usize, ) -> Result<Self, Error>
Extrudes a planar shape along a vector.
The extrusion is subdivided into slices levels. At each level the
rotation angle and scale factor are linearly interpolated from identity
(at the bottom) to the full transform (at the top).
The transform is decomposed into a rotation (axis-angle) and uniform
scale. Non-uniform scale is not supported.
Side walls are triangulated to guarantee planarity when twist is used.
Sourcepub fn lathe(self, angle_degrees: T, segments: usize) -> Result<Self, Error>
pub fn lathe(self, angle_degrees: T, segments: usize) -> Result<Self, Error>
Revolves a planar XZ-plane profile about the +Y axis (lathe).
Profile vertices (x, 0, z) sweep to (x·cosθ, z, x·sinθ); profile-x
is the radius (x ≥ 0 expected), profile-z the height along the axis.
Full revolutions weld the seam; partial sweeps are closed with start
and end caps. Side walls are triangulated (swept quads are non-planar),
and triangles degenerated by on-axis vertices are dropped.
pub fn coplanar(&self) -> bool
Sourcepub fn cast<T2: Number>(self) -> Csg<T2>where
T: AsPrimitive<T2>,
pub fn cast<T2: Number>(self) -> Csg<T2>where
T: AsPrimitive<T2>,
Cast the CSG solid’s numeric type from T to T2, e.g. f64 → f32.
Face keys are preserved unchanged; only vertex coordinates and plane
equations are converted via num_traits::cast::AsPrimitive.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Csg<T>
impl<T> RefUnwindSafe for Csg<T>where
T: RefUnwindSafe,
impl<T> Send for Csg<T>
impl<T> Sync for Csg<T>
impl<T> Unpin for Csg<T>where
T: Unpin,
impl<T> UnsafeUnpin for Csg<T>
impl<T> UnwindSafe for Csg<T>where
T: UnwindSafe + RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
§fn into_result(self) -> Result<T, RunSystemError>
fn into_result(self) -> Result<T, RunSystemError>
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.