Crate points

source ·
Expand description

Points

Crate with data structure for representing a pair of coordinates of float type.

Examples

use points::Point;
 
let p1: Point<f64> = Point::default();
let p2 = Point::new(1.0, 3.0);
 
assert_eq!(Point::new(-1.0, -3.0), p1 - p2);

Whole expression

use points::Point;
 
// execute (a + b) * 3 + (a - c)
 
let a: Point<f64> = Point::default();
let b = Point::new(1.0, 3.0);
let c = Point::new(1.5, 2.5);
let result = (a + b) * 3.0 + (a - c);
 
assert_eq!(Point::new(1.5, 6.5), result);

Structs