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]
fn from_origin(p: Vector) -> Line
Create a line using its end-point, starting in (0, 0)
fn supercover(&self) -> SuperCover
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]
fn clone(&self) -> Line
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more