Struct egui_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 set_bounds(&mut self, bounds: PlotBounds)
pub fn translate_bounds(&mut self, delta_pos: Vec2)
sourcepub fn zoom(&mut self, zoom_factor: Vec2, center: Pos2)
pub fn zoom(&mut self, zoom_factor: Vec2, center: Pos2)
Zoom by a relative factor with the given screen position as center.
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 = how many ui points per step in the X axis in “plot space”
sourcepub fn dpos_dvalue_y(&self) -> f64
pub fn dpos_dvalue_y(&self) -> f64
delta position / delta value = how many ui points per step in the Y axis in “plot space”
sourcepub fn dpos_dvalue(&self) -> [f64; 2]
pub fn dpos_dvalue(&self) -> [f64; 2]
delta position / delta value = how many ui points per step in “plot space”
sourcepub fn dvalue_dpos(&self) -> [f64; 2]
pub fn dvalue_dpos(&self) -> [f64; 2]
delta value / delta position = how much ground do we cover in “plot space” per ui point?
Trait Implementations§
source§impl Clone for PlotTransform
impl Clone for PlotTransform
source§fn clone(&self) -> PlotTransform
fn clone(&self) -> PlotTransform
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more