class

Geode::Segment

Inherits Enumerable < Geode::Line < Reference < Object

The Segment class represents a two-dimensional line segment with two endpoints.

Constructors

new(p1 : Point, p2 : Point)
Source

Instance methods

==(other : self)

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

each

Separately yields the two endpoints of the segment.

Source
hash(hasher)

See Object#hash(hasher)

include?(other : Point)

Returns whether the given point lies on the segment.

Source
length

Returns the length of the segment.

Source
midpoint

Returns the midpoint of the segment.

Source
p1

Returns the first endpoint of the segment.

Source
p2

Returns the second endpoint of the segment.

Source
slope

Returns the slope of the segment.

Source
to_line

Returns a Line representation of the segment.

Source