Struct Cubiod

pub struct Cubiod<X, Y, Z> { /* private fields */ }
Expand description

Represents a cuboid, a six-faced solid.

§Examples

use plotters::prelude::*;
let drawing_area = SVGBackend::new("cuboid.svg", (300, 200)).into_drawing_area();
drawing_area.fill(&WHITE).unwrap();
let mut chart_builder = ChartBuilder::on(&drawing_area);
let mut chart_context = chart_builder.margin(20).build_cartesian_3d(0.0..3.5, 0.0..2.5, 0.0..1.5).unwrap();
chart_context.configure_axes().x_labels(4).y_labels(3).z_labels(2).draw().unwrap();
let cubiod = Cubiod::new([(0.,0.,0.), (3.,2.,1.)], BLUE.mix(0.2), BLUE);
chart_context.draw_series(std::iter::once(cubiod)).unwrap();

The result is a semi-transparent cuboid with blue edges:

Implementations§

§

impl<X, Y, Z> Cubiod<X, Y, Z>
where X: Clone, Y: Clone, Z: Clone,

pub fn new<FS, ES>( _: [(X, Y, Z); 2], face_style: FS, edge_style: ES, ) -> Cubiod<X, Y, Z>
where FS: Into<ShapeStyle>, ES: Into<ShapeStyle>,

Creates a cuboid.

See Cubiod for more information and examples.

Trait Implementations§

§

impl<X, Y, Z, DB> Drawable<DB, BackendCoordAndZ> for Cubiod<X, Y, Z>
where DB: DrawingBackend,

§

fn draw<I>( &self, points: I, backend: &mut DB, _: (u32, u32), ) -> Result<(), DrawingErrorKind<<DB as DrawingBackend>::ErrorType>>
where I: Iterator<Item = ((i32, i32), i32)>,

Actually draws the element. The key points is already translated into the image coordinate and can be used by DC directly
§

impl<'a, X, Y, Z> PointCollection<'a, (X, Y, Z), BackendCoordAndZ> for &'a Cubiod<X, Y, Z>
where X: 'a, Y: 'a, Z: 'a,

§

type Point = &'a (X, Y, Z)

The item in point iterator
§

type IntoIter = &'a [(X, Y, Z)]

The point iterator
§

fn point_iter( self, ) -> <&'a Cubiod<X, Y, Z> as PointCollection<'a, (X, Y, Z), BackendCoordAndZ>>::IntoIter

framework to do the coordinate mapping

Auto Trait Implementations§

§

impl<X, Y, Z> Freeze for Cubiod<X, Y, Z>
where X: Freeze, Y: Freeze, Z: Freeze,

§

impl<X, Y, Z> RefUnwindSafe for Cubiod<X, Y, Z>

§

impl<X, Y, Z> Send for Cubiod<X, Y, Z>
where X: Send, Y: Send, Z: Send,

§

impl<X, Y, Z> Sync for Cubiod<X, Y, Z>
where X: Sync, Y: Sync, Z: Sync,

§

impl<X, Y, Z> Unpin for Cubiod<X, Y, Z>
where X: Unpin, Y: Unpin, Z: Unpin,

§

impl<X, Y, Z> UnwindSafe for Cubiod<X, Y, Z>
where X: UnwindSafe, Y: UnwindSafe, Z: UnwindSafe,

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
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &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)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more