pub struct ViewportCamera {
pub x_min: f64,
pub x_max: f64,
pub y_min: f32,
pub y_max: f32,
pub color: [f32; 4],
pub line_width: f32,
}Expand description
Cámara 2D para controlar el Zoom y Pan en el gráfico con $0\text{ ms}$ de latencia en CPU.
Fields§
§x_min: f64§x_max: f64§y_min: f32§y_max: f32§color: [f32; 4]§line_width: f32Implementations§
Source§impl ViewportCamera
impl ViewportCamera
pub fn new(x_min: f64, x_max: f64, y_min: f32, y_max: f32) -> Self
Sourcepub fn zoom_x(&mut self, center_x: f64, factor: f64)
pub fn zoom_x(&mut self, center_x: f64, factor: f64)
Aplica Zoom centrado en una coordenada $X$.
Sourcepub fn build_uniform(&self) -> CameraUniform
pub fn build_uniform(&self) -> CameraUniform
Genera la matriz de transformación ortográfica 4x4 mapeando las coordenadas del dataset a NDC (Normalized Device Coordinates: $[-1, 1]$).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ViewportCamera
impl RefUnwindSafe for ViewportCamera
impl Send for ViewportCamera
impl Sync for ViewportCamera
impl Unpin for ViewportCamera
impl UnsafeUnpin for ViewportCamera
impl UnwindSafe for ViewportCamera
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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