# [−][src]Struct cubic_spline::Point

```pub struct Point {
pub x: f64,
pub y: f64,
pub tension: Option<f64>,
}```

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);
```

## Blanket Implementations

### `impl<T> ToOwned for T where    T: Clone, `[src]

#### `type Owned = T`

The resulting type after obtaining ownership.

### `impl<T, U> TryFrom<U> for T where    U: Into<T>, `[src]

#### `type Error = Infallible`

The type returned in the event of a conversion error.

### `impl<T, U> TryInto<U> for T where    U: TryFrom<T>, `[src]

#### `type Error = <U as TryFrom<T>>::Error`

The type returned in the event of a conversion error.