Struct maelstrom_plot::PlotTransform
source · pub struct PlotTransform { /* private fields */ }
Expand description
Contains the screen rectangle and the plot bounds and provides methods to transform between them.
Implementations§
source§impl PlotTransform
impl PlotTransform
pub fn new( frame: Rect, bounds: PlotBounds, x_centered: bool, y_centered: bool ) -> Self
sourcepub fn bounds(&self) -> &PlotBounds
pub fn bounds(&self) -> &PlotBounds
Plot-space bounds.
pub fn position_from_point_x(&self, value: f64) -> f32
pub fn position_from_point_y(&self, value: f64) -> f32
sourcepub fn position_from_point(&self, value: &PlotPoint) -> Pos2
pub fn position_from_point(&self, value: &PlotPoint) -> Pos2
Screen/ui position from point on plot.
sourcepub fn value_from_position(&self, pos: Pos2) -> PlotPoint
pub fn value_from_position(&self, pos: Pos2) -> PlotPoint
Plot point from screen/ui position.
sourcepub fn rect_from_values(&self, value1: &PlotPoint, value2: &PlotPoint) -> Rect
pub fn rect_from_values(&self, value1: &PlotPoint, value2: &PlotPoint) -> Rect
Transform a rectangle of plot values to a screen-coordinate rectangle.
This typically means that the rect is mirrored vertically (top becomes bottom and vice versa), since the plot’s coordinate system has +Y up, while egui has +Y down.
sourcepub fn dpos_dvalue_x(&self) -> f64
pub fn dpos_dvalue_x(&self) -> f64
delta position / delta value
sourcepub fn dpos_dvalue_y(&self) -> f64
pub fn dpos_dvalue_y(&self) -> f64
delta position / delta value
sourcepub fn dpos_dvalue(&self) -> [f64; 2]
pub fn dpos_dvalue(&self) -> [f64; 2]
delta position / delta value
sourcepub fn dvalue_dpos(&self) -> [f64; 2]
pub fn dvalue_dpos(&self) -> [f64; 2]
delta value / delta position
Trait Implementations§
source§impl Clone for PlotTransform
impl Clone for PlotTransform
source§fn clone(&self) -> PlotTransform
fn clone(&self) -> PlotTransform
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for PlotTransform
impl Debug for PlotTransform
impl Copy for PlotTransform
Auto Trait Implementations§
impl Freeze for PlotTransform
impl RefUnwindSafe for PlotTransform
impl Send for PlotTransform
impl Sync for PlotTransform
impl Unpin for PlotTransform
impl UnwindSafe for PlotTransform
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