pub struct TernaryViewport { /* private fields */ }Expand description
An axis-aligned logical rectangle in the projected ternary plane.
The viewport is a clipping and zoom window. It has no drawing behaviour and does not imply a visible frame or Cartesian axes.
Implementations§
Source§impl TernaryViewport
impl TernaryViewport
Sourcepub fn new(
x_min: f64,
x_max: f64,
y_min: f64,
y_max: f64,
) -> Result<Self, Error>
pub fn new( x_min: f64, x_max: f64, y_min: f64, y_max: f64, ) -> Result<Self, Error>
Construct a viewport using Tolerance::default for span validation.
Sourcepub fn new_with_tolerance(
x_min: f64,
x_max: f64,
y_min: f64,
y_max: f64,
tolerance: Tolerance,
) -> Result<Self, Error>
pub fn new_with_tolerance( x_min: f64, x_max: f64, y_min: f64, y_max: f64, tolerance: Tolerance, ) -> Result<Self, Error>
Construct a viewport using an explicit minimum-span tolerance.
Sourcepub fn full(geometry: TernaryGeometry) -> Self
pub fn full(geometry: TernaryGeometry) -> Self
Return the tight axis-aligned bounds of the complete projected triangle.
use plotters_ternary::{TernaryGeometry, TernaryViewport};
let viewport = TernaryViewport::full(TernaryGeometry::default());
assert_eq!(viewport.x_min(), 0.0);
assert_eq!(viewport.x_max(), 1.0);Sourcepub fn contains(
self,
cartesian: TernaryCartesian,
tolerance: Tolerance,
) -> Result<bool, Error>
pub fn contains( self, cartesian: TernaryCartesian, tolerance: Tolerance, ) -> Result<bool, Error>
Return whether a point is inside or on the viewport within tolerance.
Sourcepub fn classify(
self,
cartesian: TernaryCartesian,
tolerance: Tolerance,
) -> Result<ViewportPointLocation, Error>
pub fn classify( self, cartesian: TernaryCartesian, tolerance: Tolerance, ) -> Result<ViewportPointLocation, Error>
Classify a point against the viewport independently of triangle geometry.
Trait Implementations§
Source§impl Clone for TernaryViewport
impl Clone for TernaryViewport
impl Copy for TernaryViewport
Source§impl Debug for TernaryViewport
impl Debug for TernaryViewport
Source§impl PartialEq for TernaryViewport
impl PartialEq for TernaryViewport
impl StructuralPartialEq for TernaryViewport
Auto Trait Implementations§
impl Freeze for TernaryViewport
impl RefUnwindSafe for TernaryViewport
impl Send for TernaryViewport
impl Sync for TernaryViewport
impl Unpin for TernaryViewport
impl UnsafeUnpin for TernaryViewport
impl UnwindSafe for TernaryViewport
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