struct PF2d::Line(T)

Overview

Represents a line between two points Line(Vec(Int32, 2))

Defined in:

pf2d/line.cr

Constructors

Macro Summary

Instance Method Summary

Constructor Detail

def self.new(p1 : T, p2 : T) #

[View source]

Macro Detail

macro [](*args) #

[View source]

Instance Method Detail

def /(n : Float | Int) #

[View source]
def bottom #

[View source]
def contains_y?(y) #

[View source]
def intersects?(other : Line(T)) : Vec2(Float64) | Nil #

Return the point where the two lines would intersect unless parallel


[View source]
def inv_slope #

[View source]
def left #

[View source]
def length #

Return the length of the line


[View source]
def lerp(t : Float64) #

Linearly interpolate


[View source]
def normal #

Find the normal axis to this line


[View source]
def normal_cc #

Normal counter clockwise


[View source]
def p1 : T #

[View source]
def p1=(p1 : T) #

[View source]
def p2 : T #

[View source]
def p2=(p2 : T) #

[View source]
def point_pointers #

[View source]
def right #

[View source]
def rise #

The height from the starting point to the ending point


[View source]
def run #

The length from the starting point to the ending point


[View source]
def slope #

[View source]
def to_vector #

Convert this line into a normalized vector


[View source]
def top #

[View source]
def x_at(y) #

[View source]
def y_at(x) #

[View source]