Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions plotters/src/element/basic_shapes_3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,25 @@ 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();
let cuboid = Cuboid::new([(0.,0.,0.), (3.,2.,1.)], BLUE.mix(0.2), BLUE);
chart_context.draw_series(std::iter::once(cuboid)).unwrap();
```

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

![](https://cdn.jsdelivr.net/gh/facorread/plotters-doc-data@b6703f7/apidoc/cuboid.svg)
*/
pub struct Cubiod<X, Y, Z> {
pub struct Cuboid<X, Y, Z> {
face_style: ShapeStyle,
edge_style: ShapeStyle,
vert: [(X, Y, Z); 8],
}

impl<X: Clone, Y: Clone, Z: Clone> Cubiod<X, Y, Z> {
impl<X: Clone, Y: Clone, Z: Clone> Cuboid<X, Y, Z> {
/**
Creates a cuboid.

See [`Cubiod`] for more information and examples.
See [`Cuboid`] for more information and examples.
*/
#[allow(clippy::redundant_clone)]
pub fn new<FS: Into<ShapeStyle>, ES: Into<ShapeStyle>>(
Expand All @@ -58,7 +58,7 @@ impl<X: Clone, Y: Clone, Z: Clone> Cubiod<X, Y, Z> {
}

impl<'a, X: 'a, Y: 'a, Z: 'a> PointCollection<'a, (X, Y, Z), BackendCoordAndZ>
for &'a Cubiod<X, Y, Z>
for &'a Cuboid<X, Y, Z>
{
type Point = &'a (X, Y, Z);
type IntoIter = &'a [(X, Y, Z)];
Expand All @@ -67,7 +67,7 @@ impl<'a, X: 'a, Y: 'a, Z: 'a> PointCollection<'a, (X, Y, Z), BackendCoordAndZ>
}
}

impl<X, Y, Z, DB: DrawingBackend> Drawable<DB, BackendCoordAndZ> for Cubiod<X, Y, Z> {
impl<X, Y, Z, DB: DrawingBackend> Drawable<DB, BackendCoordAndZ> for Cuboid<X, Y, Z> {
fn draw<I: Iterator<Item = (BackendCoord, i32)>>(
&self,
points: I,
Expand Down
2 changes: 1 addition & 1 deletion plotters/src/element/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ impl CoordMapper for BackendCoordOnly {
/**
Used for 3d coordinate transformations.

See [`Cubiod`] for more information and an example.
See [`Cuboid`] for more information and an example.
*/
pub struct BackendCoordAndZ;

Expand Down
2 changes: 1 addition & 1 deletion plotters/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,7 @@ pub mod prelude {

// Elements
pub use crate::element::{
Circle, Cross, Cubiod, DynElement, EmptyElement, IntoDynElement, MultiLineText,
Circle, Cross, Cuboid, DynElement, EmptyElement, IntoDynElement, MultiLineText,
PathElement, Pie, Pixel, Polygon, Rectangle, Text, TriangleMarker,
};

Expand Down
Loading