pub struct TriangleArrow<Coord, Size: SizeDesc> { /* private fields */ }
Implementations§
Source§impl<Coord> TriangleArrow<Coord, i32>
impl<Coord> TriangleArrow<Coord, i32>
Sourcepub fn new(nock: Coord, tip: Coord, style: impl Into<ShapeStyle>) -> Self
pub fn new(nock: Coord, tip: Coord, style: impl Into<ShapeStyle>) -> Self
Examples found in repository?
examples/triangle-arrows.rs (line 31)
7fn main() -> Result<(), DrawingAreaErrorKind<<BitMapBackend<'static> as DrawingBackend>::ErrorType>>
8{
9 let target = Path::new("example.png");
10 let graph_root = BitMapBackend::new(target, (256, 256)).into_drawing_area();
11 graph_root.fill(&WHITE)?;
12 let mut chart = ChartBuilder::on(&graph_root)
13 .margin(8)
14 .x_label_area_size(24)
15 .y_label_area_size(24)
16 .build_cartesian_2d(0f64..1f64, 0f64..1f64)?;
17
18 chart.configure_mesh().draw()?;
19
20 let x_count = 16;
21 let y_count = 16;
22 let arrow_size = 0.05;
23 chart.draw_series(
24 (0..=x_count)
25 .flat_map(|xi| (0..=y_count).map(move |yi| (xi, yi)))
26 .map(|(xi, yi)| {
27 let x = xi as f64 / x_count as f64;
28 let y = yi as f64 / y_count as f64;
29 let dx = arrow_size * f64::cos(y * TAU);
30 let dy = arrow_size * f64::cos(x * TAU);
31 TriangleArrow::new((x, y), (x + dx, y + dy), &RED)
32 }),
33 )?;
34
35 graph_root.present()?;
36
37 Ok(())
38}
Source§impl<Coord, Size: SizeDesc> TriangleArrow<Coord, Size>
impl<Coord, Size: SizeDesc> TriangleArrow<Coord, Size>
pub fn new_detail( nock: Coord, tip: Coord, head: Size, width: Size, style: impl Into<ShapeStyle>, ) -> Self
pub fn head(self, head: Size) -> Self
pub fn width(self, width: Size) -> Self
Trait Implementations§
Source§impl<Coord: Clone, Size: Clone + SizeDesc> Clone for TriangleArrow<Coord, Size>
impl<Coord: Clone, Size: Clone + SizeDesc> Clone for TriangleArrow<Coord, Size>
Source§fn clone(&self) -> TriangleArrow<Coord, Size>
fn clone(&self) -> TriangleArrow<Coord, Size>
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<DB: DrawingBackend, Coord, Size: SizeDesc> Drawable<DB> for TriangleArrow<Coord, Size>
impl<DB: DrawingBackend, Coord, Size: SizeDesc> Drawable<DB> for TriangleArrow<Coord, Size>
Auto Trait Implementations§
impl<Coord, Size> Freeze for TriangleArrow<Coord, Size>
impl<Coord, Size> RefUnwindSafe for TriangleArrow<Coord, Size>where
Size: RefUnwindSafe,
Coord: RefUnwindSafe,
impl<Coord, Size> Send for TriangleArrow<Coord, Size>
impl<Coord, Size> Sync for TriangleArrow<Coord, Size>
impl<Coord, Size> Unpin for TriangleArrow<Coord, Size>
impl<Coord, Size> UnwindSafe for TriangleArrow<Coord, Size>where
Size: UnwindSafe,
Coord: UnwindSafe,
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<'b, T, DB, Coord> IntoDynElement<'b, DB, Coord> for Twhere
T: Drawable<DB> + 'b,
&'a T: for<'a> PointCollection<'a, Coord>,
Coord: Clone,
DB: DrawingBackend,
impl<'b, T, DB, Coord> IntoDynElement<'b, DB, Coord> for Twhere
T: Drawable<DB> + 'b,
&'a T: for<'a> PointCollection<'a, Coord>,
Coord: Clone,
DB: DrawingBackend,
Source§fn into_dyn(self) -> DynElement<'b, DB, Coord>
fn into_dyn(self) -> DynElement<'b, DB, Coord>
Make the conversion