class

Geode::Line

Inherits Reference < Object

The Line class represents a two-dimensional line with no defined endpoints. For a line with endpoints, see the Segment class.

Constructors

new(slope : Number::Primitive, intercept_val : Number::Primitive)

Creates a new Line.

Source

Class methods

perpendicular?(l1 : Line, l2 : Line)

Returns whether the two given lines are perpendicular to each other.

Source

Instance methods

==(other : self)

Returns true if this reference is the same as other. Invokes same?.

hash(hasher)

See Object#hash(hasher)

horizontal?

Returns whether the line is horizontal.

Source
include?(other : Point)

Returns whether the given point lies on the line.

Source
slope

Returns the slope of the line.

Source
to_s(io : IO)

Returns a string representation of the line in slope-intercept form (y = mx + b). A vertical line will return a string in the form x = c where c is the line's x-intercept.

Source
vertical?

Returns whether the line is vertical.

Source
x_intercept

Returns the x-intercept of the line. If the line is horizontal, it has no x-intercept, so it returns nil.

Source
y_intercept

Returns the y-intercept of the line. If the line is vertical, it has no y-intercept, so it returns nil.

Source