class Geode::Line
- Geode::Line
- Reference
- Object
Overview
The Line
class represents a two-dimensional line with no defined endpoints.
For a line with endpoints, see the Segment
class.
Direct Known Subclasses
Defined in:
geode/line.crConstructors
Class Method Summary
-
.perpendicular?(l1 : Line, l2 : Line)
Returns whether the two given lines are perpendicular to each other.
Instance Method Summary
-
#==(other : self)
Returns
true
if this reference is the same as other. -
#hash(hasher)
See
Object#hash(hasher)
-
#horizontal?
Returns whether the line is horizontal.
-
#include?(other : Point)
Returns whether the given point lies on the line.
-
#slope : Float32 | Float64 | Int128 | Int16 | Int32 | Int64 | Int8 | UInt128 | UInt16 | UInt32 | UInt64 | UInt8
Returns the slope of the line.
-
#to_s(io : IO)
Returns a string representation of the line in slope-intercept form (
y = mx + b
). -
#vertical?
Returns whether the line is vertical.
-
#x_intercept
Returns the x-intercept of the line.
-
#y_intercept
Returns the y-intercept of the line.
Constructor Detail
Class Method Detail
Returns whether the two given lines are perpendicular to each other.
Instance Method Detail
Returns true
if this reference is the same as other. Invokes same?
.
Returns the slope of the line.
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.
Returns the x-intercept of the line. If the line is horizontal, it has no x-intercept, so it returns nil
.
Returns the y-intercept of the line. If the line is vertical, it has no y-intercept, so it returns nil
.