Skip to main content

DynamicObject

Enum DynamicObject 

Source
pub enum DynamicObject {
Show 23 variants Cube { size: [f64; 3], }, Sphere { radius: f64, segments: usize, stacks: usize, }, Cylinder { radius: f64, height: f64, segments: usize, }, Cone { radius: f64, height: f64, segments: usize, }, Circle { radius: f64, segments: usize, }, Square { size: [f64; 2], }, Polygon { points: Vec<[f64; 2]>, }, Sketch { data: SketchData, }, Union { children: Vec<DynamicObject>, }, Difference { children: Vec<DynamicObject>, }, Intersection { children: Vec<DynamicObject>, }, Translate { offset: [f64; 3], child: Box<DynamicObject>, }, Rotate { angles: [f64; 3], child: Box<DynamicObject>, }, Scale { factors: [f64; 3], child: Box<DynamicObject>, }, Mirror { axis: [f64; 3], child: Box<DynamicObject>, }, Color { color: [f64; 4], child: Box<DynamicObject>, }, Material { material: MaterialData, child: Box<DynamicObject>, }, LinearExtrude { height: f64, twist: f64, scale: f64, slices: usize, child: Box<DynamicObject>, }, Revolve { angle_degrees: f64, segments: usize, child: Box<DynamicObject>, }, Offset { delta: f64, round: bool, chamfer: bool, segments: usize, child: Box<DynamicObject>, }, EdgeFeature { data: EdgeFeatureData, child: Box<DynamicObject>, }, Group { children: Vec<DynamicObject>, }, Empty,
}
Expand description

A dynamically-typed CSG object node.

Implements Object so it can be used anywhere a static rscad-core object can, and can be serialized/deserialized when the serde feature is enabled.

Variants§

§

Cube

Fields

§size: [f64; 3]
§

Sphere

Fields

§radius: f64
§segments: usize
§stacks: usize
§

Cylinder

Fields

§radius: f64
§height: f64
§segments: usize
§

Cone

Fields

§radius: f64
§height: f64
§segments: usize
§

Circle

Fields

§radius: f64
§segments: usize
§

Square

Fields

§size: [f64; 2]
§

Polygon

Fields

§points: Vec<[f64; 2]>
§

Sketch

Constraint-based 2D sketch (see crate::sketch). Lives in its local XZ plane like the other 2D primitives.

Fields

§

Union

Implicit union of all children.

Fields

§children: Vec<DynamicObject>
§

Difference

First child minus all subsequent children.

Fields

§children: Vec<DynamicObject>
§

Intersection

Intersection of all children.

Fields

§children: Vec<DynamicObject>
§

Translate

Fields

§offset: [f64; 3]
§

Rotate

Rotation in degrees (OpenSCAD convention).

Fields

§angles: [f64; 3]
§

Scale

Fields

§factors: [f64; 3]
§

Mirror

Fields

§axis: [f64; 3]
§

Color

RGBA color (0.0–1.0).

Fields

§color: [f64; 4]
§

Material

PBR surface finish (metallic/roughness); albedo stays in Self::Color.

Fields

§material: MaterialData
§

LinearExtrude

Fields

§height: f64
§twist: f64
§scale: f64
§slices: usize
§

Revolve

Revolve the child 2D profile about its local Y axis (OpenSCAD rotate_extrude). Profile-x is the radius (x ≥ 0 expected).

Fields

§angle_degrees: f64
§segments: usize
§

Offset

Grow/shrink the child 2D profile by delta (OpenSCAD offset()).

Fields

§delta: f64
§round: bool

Round corners (offset(r=…)); when set, chamfer is ignored.

§chamfer: bool

Cut off miter spikes (offset(delta=…, chamfer=true)).

§segments: usize

Arc tessellation for round joins.

§

EdgeFeature

Chamfer/fillet the child’s selected edges. Backends never see this variant directly — it lowers to plain CSG masks against the child ([crate::feature::lower]), re-resolved on every evaluation so the feature follows parameter edits.

§

Group

Implicit union of children (convenience wrapper).

Fields

§children: Vec<DynamicObject>
§

Empty

Empty geometry — produces no polygons.

Implementations§

Source§

impl DynamicObject

Source

pub fn extract_top_transforms(&self) -> ExtractedTransforms<'_>

Peel off top-level Translate/Rotate/Scale/Color nodes that are not under any boolean operation, producing an accumulated affine matrix, an optional color, and a reference to the remaining inner subtree.

Extraction stops at booleans (Union, Difference, Intersection), Mirror (negative scale breaks face winding), LinearExtrude, Group, primitives, and Empty.

Trait Implementations§

Source§

impl Clone for DynamicObject

Source§

fn clone(&self) -> DynamicObject

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DynamicObject

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for DynamicObject

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Object for DynamicObject

Source§

fn name(&self) -> Option<&'static str>

Source§

impl PartialEq for DynamicObject

Source§

fn eq(&self, other: &DynamicObject) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for DynamicObject

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl ToDynamic for DynamicObject

Source§

impl StructuralPartialEq for DynamicObject

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CenterObject for T
where T: Object,

Source§

fn centered(self, centered: bool) -> Centered<Self>
where Self: Object + Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> ColorObject for T
where T: Object,

Source§

fn colored(self, color: impl ColorFormat) -> Colored<T>

Source§

impl<T> DifferenceObject for T
where T: Object,

Source§

fn difference<Other: Object>(self, other: Other) -> Difference<Self, Other>

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, W> HasTypeWitness<W> for T
where W: MakeTypeWitness<Arg = T>, T: ?Sized,

§

const WITNESS: W = W::MAKE

A constant of the type witness
§

impl<T> Identity for T
where T: ?Sized,

§

const TYPE_EQ: TypeEq<T, <T as Identity>::Type> = TypeEq::NEW

Proof that Self is the same type as Self::Type, provides methods for casting between Self and Self::Type.
§

type Type = T

The same type as Self, used to emulate type equality bounds (T == U) with associated type equality constraints (T: Identity<Type = U>).
Source§

impl<T> IntersectionObject for T
where T: Object,

Source§

fn intersection<Other: Object>(self, other: Other) -> Intersection<Self, Other>

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> LinearPatternObject for T
where T: Object + Clone,

Source§

fn repeat<const N: usize>( self, offset: impl Number, direction: DVec3, ) -> Pattern<Self, N>
where Self: Sized,

Source§

fn repeated( self, offset: impl Number, direction: DVec3, times: usize, ) -> PatternRuntime<Self>
where Self: Sized,

Source§

impl<T> MirrorObject for T
where T: Object,

Source§

fn mirror<T: Number>(self, x: T, y: T, z: T) -> Mirror<Self>
where Self: Sized,

Source§

fn mirror_x<T: Number>(self, x: T) -> Mirror<Self>
where Self: Sized,

Source§

fn mirror_y<T: Number>(self, y: T) -> Mirror<Self>
where Self: Sized,

Source§

fn mirror_z<T: Number>(self, z: T) -> Mirror<Self>
where Self: Sized,

Source§

fn mirror_xy<T: Number>(self, x: T, y: T) -> Mirror<Self>
where Self: Sized,

Source§

fn mirror_xz<T: Number>(self, x: T, z: T) -> Mirror<Self>
where Self: Sized,

Source§

fn mirror_yz<T: Number>(self, y: T, z: T) -> Mirror<Self>
where Self: Sized,

Source§

impl<T> ProjectionObject<T> for T
where T: Object,

Source§

fn project(self) -> Projection<Self>

Source§

impl<T> RotateObject for T
where T: Object,

Source§

fn rotate<T: Number>(self, x: T, y: T, z: T) -> Rotate<Self>
where Self: Sized,

Source§

fn rotate_x<T: Number>(self, x: T) -> Rotate<Self>
where Self: Sized,

Source§

fn rotate_y<T: Number>(self, y: T) -> Rotate<Self>
where Self: Sized,

Source§

fn rotate_z<T: Number>(self, z: T) -> Rotate<Self>
where Self: Sized,

Source§

fn rotate_xy<T: Number>(self, x: T, y: T) -> Rotate<Self>
where Self: Sized,

Source§

fn rotate_yz<T: Number>(self, y: T, z: T) -> Rotate<Self>
where Self: Sized,

Source§

fn rotate_xz<T: Number>(self, x: T, z: T) -> Rotate<Self>
where Self: Sized,

Source§

impl<T> ScaleObject for T
where T: Object,

Source§

fn scale_uniform<T: Number>(self, scaler: T) -> Scale<Self>
where Self: Sized,

Source§

fn scale<T: Number>(self, x: T, y: T, z: T) -> Scale<Self>
where Self: Sized,

Source§

fn scale_x<T: Number>(self, x: T) -> Scale<Self>
where Self: Sized,

Source§

fn scale_y<T: Number>(self, y: T) -> Scale<Self>
where Self: Sized,

Source§

fn scale_z<T: Number>(self, z: T) -> Scale<Self>
where Self: Sized,

Source§

fn scale_xy<T: Number>(self, x: T, y: T) -> Scale<Self>
where Self: Sized,

Source§

fn scale_xz<T: Number>(self, x: T, z: T) -> Scale<Self>
where Self: Sized,

Source§

fn scale_yz<T: Number>(self, y: T, z: T) -> Scale<Self>
where Self: Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> TranslateObject for T
where T: Object,

Source§

fn translate<T: Number>(self, x: T, y: T, z: T) -> Translate<Self>
where Self: Sized,

Source§

fn translate_x<T: Number>(self, x: T) -> Translate<Self>
where Self: Sized,

Source§

fn translate_y<T: Number>(self, y: T) -> Translate<Self>
where Self: Sized,

Source§

fn translate_z<T: Number>(self, z: T) -> Translate<Self>
where Self: Sized,

Source§

fn translate_xy<T: Number>(self, x: T, y: T) -> Translate<Self>
where Self: Sized,

Source§

fn translate_xz<T: Number>(self, x: T, z: T) -> Translate<Self>
where Self: Sized,

Source§

fn translate_yz<T: Number>(self, y: T, z: T) -> Translate<Self>
where Self: Sized,

Source§

fn translate_vector(self, vector: DVec3) -> Translate<Self>
where Self: Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<A, B> TwoContainerObject<B> for A
where A: Object, B: Object,

Source§

fn and(self, other: B) -> TwoContainer<Self, B>
where Self: Sized,

Source§

fn copy_and(self, process: impl FnOnce(Self) -> B) -> TwoContainer<Self, B>
where Self: Sized + Copy,

Source§

fn clone_and(self, process: impl FnOnce(Self) -> B) -> TwoContainer<Self, B>
where Self: Sized + Clone,

Source§

impl<T> UnionObject for T
where T: Object,

Source§

fn union<Other: Object>(self, other: Other) -> Union<Self, Other>

Source§

impl<T> XorObject for T
where T: Object,

Source§

fn xor<Other: Object>(self, other: Other) -> Xor<Self, Other>

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<T> OpaqueAttachment for T
where T: Send + Sync + 'static,