The class PLRuby::Segment implement the PostgreSQL type lseg
Convert a String (PostgreSQL representation) to a Segment
create a Segment from the 2 Point p0, p1
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])
return the center of the segment
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.
returns true if self is a horizontal Segment
returns true if self and other intersect
returns the Point where the 2 Segment self and other intersect or nil
return the length of self, i.e. the distnace between the 2 points
return true if self is on other
other can be a Segment, or a Box object
returns true if the 2 Segment self and other are parallel
returns true if self is perpendicular to other
conversion function to a Point, return the center of the segment
returns true if self is a vertical Segment
[Validate]