In Files

Parent

Included Modules

PLRuby::Segment

The class PLRuby::Segment implement the PostgreSQL type lseg

Public Class Methods

from_string(string) click to toggle source

Convert a String (PostgreSQL representation) to a Segment

# File plruby.rb, line 1653
def from_string(string)
end
new(point0, point1) click to toggle source

create a Segment from the 2 Point p0, p1

# File plruby.rb, line 1687
def initialize(point0, point1)
end

Public Instance Methods

<=>(other) click to toggle source

comparison function for the 2 segments, returns

0  if self[0] == other[0] && self[1] == other[1]

1  if distance(self[0], self[1]) > distance(other[0], other[1]) 

-1 if distance(self[0], self[1]) < distance(other[0], other[1])
# File plruby.rb, line 1664
def <=>(other)
end
center() click to toggle source

return the center of the segment

# File plruby.rb, line 1668
def center
end
closest(other) click to toggle source

closest point to other

other can be a Point, Segment or Box

With a point, take the closest endpoint if the point is left, right, above, or below the segment, otherwise find the intersection point of the segment and its perpendicular through the point.

# File plruby.rb, line 1679
def closest(other)
end
horizontal?() click to toggle source

returns true if self is a horizontal Segment

# File plruby.rb, line 1683
def horizontal?
end
intersect?(other) click to toggle source

returns true if self and other intersect

# File plruby.rb, line 1691
def intersect?(other)
end
intersection(other) click to toggle source

returns the Point where the 2 Segment self and other intersect or nil

# File plruby.rb, line 1696
def intersection(other)
end
length() click to toggle source

return the length of self, i.e. the distnace between the 2 points

# File plruby.rb, line 1700
def length
end
on?(other) click to toggle source

return true if self is on other

other can be a Segment, or a Box object

# File plruby.rb, line 1706
def on?(other)
end
parallel?(other) click to toggle source

returns true if the 2 Segment self and other are parallel

# File plruby.rb, line 1711
def parallel?(other)
end
perpendicular?(other) click to toggle source

returns true if self is perpendicular to other

# File plruby.rb, line 1715
def perpendicular?(other)
end
to_point() click to toggle source

conversion function to a Point, return the center of the segment

# File plruby.rb, line 1719
def to_point
end
vertical?() click to toggle source

returns true if self is a vertical Segment

# File plruby.rb, line 1723
def vertical?
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.