Struct tile_net::Line [] [src]

pub struct Line(pub Vector, pub Vector);

Describe a line by its start and end Vector respectively

A line can be constructed and used with tuples

use tile_net::{Line, Vector};
let start = Vector(0.5, 1.0);
let finish = Vector(1.2, -1.0);
let line = Line(start, finish);
assert_eq!(line.0, start);
assert_eq!(line.1, finish);

Methods

impl Line
[src]

Create a line using its end-point, starting in (0, 0)

Create a supercover line iterator

The supercover line covers all discrete blocks. It's similar to Bresenham's algorithm, but it includes the blocks that have been overlapped by a small portion of the line. The blocks are given by an integer boundary.

This particular algorithm is based off http://lodev.org/cgtutor/raycasting.html It is a ray tracer.

The created iterator leaps from the start to the end node. The intended use for this iterator is in finding a collision between a tile and a moving object.

Trait Implementations

impl Clone for Line
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Copy for Line
[src]

impl Debug for Line
[src]

Formats the value using the given formatter.

impl PartialEq for Line
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.