[−][src]Struct cubic_spline::Point
The point in 2d coordinate system.
Fields
x: f64
x-axis point value.
y: f64
y-axis point value.
tension: Option<f64>
Optional tension of the curve between this point and the next point.
Implementations
impl Point
[src]
pub fn new(x: f64, y: f64) -> Self
[src]
Creates new point. You may prefer use From
/Into
implementations for this.
pub fn with_tension(x: f64, y: f64, tension: f64) -> Self
[src]
Creates new point with tension of the curve between it and the next point.
If points creates with ::new
the tension from SplineOpts
will be used.
pub fn approx_eq(&self, other: &Point) -> bool
[src]
Tests the approximate equality of two points with default precision -
DEFAULT_APPROX_EQ_PRECISION
use cubic_spline::Point; assert!(Point::new(1.2,3.5).approx_eq(&[1.2, 3.5].into()));
pub fn approx_eq_with_precision(&self, other: &Point, precision: f64) -> bool
[src]
Tests the approximate equality with specific precision
use cubic_spline::Point; assert!(Point::new(1.0,1.0).approx_eq_with_precision(&[1.000_001, 1.0].into(), 0.000_1)); assert!(Point::new(1.000_1,1.0).approx_eq_with_precision(&[1.0, 1.0].into(), 0.01));
pub fn invert_horizontally(&mut self, width: f64)
[src]
Inverts the x-value of the point based on the width of the canvas.
Example
use cubic_spline::Point; let mut p = Point::new(1.0, 3.0); p.invert_horizontally(3.0); assert_eq!(p.x, 2.0); assert_eq!(p.y, 3.0);
pub fn invert_vertically(&mut self, height: f64)
[src]
Inverts the y-value of the point based on the height of the canvas.
Example
use cubic_spline::Point; let mut p = Point::new(1.0, 3.0); p.invert_vertically(7.0); assert_eq!(p.x, 1.0); assert_eq!(p.y, 4.0);
Trait Implementations
impl Clone for Point
[src]
impl Debug for Point
[src]
impl Default for Point
[src]
impl<'a> From<&'a Point> for Point
[src]
impl<'a, T: Copy> From<&'a T> for Point where
T: Into<Point>,
[src]
T: Into<Point>,
impl<T> From<[T; 2]> for Point where
(T, T): Into<Point>,
[src]
(T, T): Into<Point>,
impl From<(f64, f64)> for Point
[src]
Auto Trait Implementations
impl RefUnwindSafe for Point
[src]
impl Send for Point
[src]
impl Sync for Point
[src]
impl Unpin for Point
[src]
impl UnwindSafe for Point
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,