Type Definition geologic::Point2D

source · []
pub type Point2D<T> = Vector2D<T, Point>;
Expand description

A two-dimensional vector representing a point.

Examples

let point = point!(10, 0);

// A point can be moved with an offset
let moved_point = point + offset!(20, 5);
assert_eq!(moved_point, point!(30, 5));

// A tuple offset can also be used
let moved_point = point + (20, 5);
assert_eq!(moved_point, point!(30, 5));

Implementations

Returns the offset between self and point.

Order matters here, so if you are trying to get the offset needed for point A to get to point B, you would do a.offset(b).

Examples
let a = point!(10, 40);
let b = point!(5, 60);

assert_eq!(a.offset(b), offset!(-5, 20));

Returns a new Bounds2D using self as position, and size as the size.

Examples
let bounds = point!(20u32, 30).with_size(size!(50; 2));

assert_eq!(bounds, bounds!(20, 30, 50, 50));

Trait Implementations

The resulting type after applying the + operator.

Performs the + operation. Read more

The resulting type after applying the - operator.

Performs the - operation. Read more