AdHocShape

Struct AdHocShape 

Source
pub struct AdHocShape(pub Shape);
Expand description

Wrapper for the Shape struct that provides an “ad-hoc” API. New code is encouraged to use more fine-grained API in the [primitives] module.

Tuple Fields§

§0: Shape

Implementations§

Source§

impl AdHocShape

Source

pub fn make_box(x: f64, y: f64, z: f64) -> Self

Make a box with a corner at (0,0,0) and with size (x,y,z)

Source

pub fn make_box_point_point(p1: DVec3, p2: DVec3) -> Self

Make a box with one corner at p1, and the opposite corner at p2.

Source

pub fn make_cylinder(p: DVec3, r: f64, h: f64) -> Self

Make a cylinder with its bottom at point p, with radius r and height h.

Source

pub fn extrude_polygon(points: &[DVec3], h: f64) -> Self

Purposefully underpowered for now, this simply takes a list of points, creates a face out of them, and then extrudes it by h in the positive Z direction.

Source

pub fn drill_hole(&mut self, p: DVec3, dir: DVec3, radius: f64)

Drills a cylindrical hole starting at point p, pointing down the Z axis (this will later change to be an arbitrary axis).

Source

pub fn write_stl<P: AsRef<Path>>(&self, path: P)

Source

pub fn fillet_edges(&mut self, radius: f64)

Source

pub fn chamfer_edges(&mut self, distance: f64)

Source

pub fn subtract(&mut self, other: &Shape)

Source

pub fn union(&mut self, other: &Shape)

Source

pub fn intersect(&mut self, other: &Shape)

Methods from Deref<Target = Shape>§

Source

pub fn shape_type(&self) -> ShapeType

Source

pub fn fillet_edge(&mut self, radius: f64, edge: &Edge)

Source

pub fn chamfer_edge(&mut self, distance: f64, edge: &Edge)

Source

pub fn fillet_edges<T: AsRef<Edge>>( &mut self, radius: f64, edges: impl IntoIterator<Item = T>, )

Source

pub fn chamfer_edges<T: AsRef<Edge>>( &mut self, distance: f64, edges: impl IntoIterator<Item = T>, )

Source

pub fn fillet(&mut self, radius: f64)

Performs fillet of radius on all edges of the shape

Source

pub fn chamfer(&mut self, distance: f64)

Performs chamfer of distance on all edges of the shape

Source

pub fn subtract(&self, other: &Shape) -> BooleanShape

Source

pub fn write_step(&self, path: impl AsRef<Path>) -> Result<(), Error>

Source

pub fn union(&self, other: &Shape) -> BooleanShape

Source

pub fn write_stl<P: AsRef<Path>>(&self, path: P) -> Result<(), Error>

Source

pub fn clean(&mut self)

Source

pub fn set_global_translation(&mut self, translation: DVec3)

Source

pub fn mesh(&self) -> Mesh

Source

pub fn edges(&self) -> EdgeIterator

Source

pub fn faces(&self) -> FaceIterator

Source

pub fn faces_along_ray( &self, ray_start: DVec3, ray_dir: DVec3, ) -> Vec<(Face, DVec3)>

Trait Implementations§

Source§

impl Deref for AdHocShape

Source§

type Target = Shape

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Shape

Dereferences the value.
Source§

impl DerefMut for AdHocShape

Source§

fn deref_mut(&mut self) -> &mut Shape

Mutably dereferences the value.
Source§

impl From<AdHocShape> for Shape

Source§

fn from(adhoc_shape: AdHocShape) -> Self

Converts to this type from the input type.

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> IntoShape for T
where T: Into<Shape>,

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.