Method: RGeo::Cartesian::Segment#side

Defined in:
lib/rgeo/cartesian/calculations.rb

#side(point) ⇒ Object

Returns a negative value if the point is to the left, a positive value if the point is to the right, or 0 if the point is collinear to the segment.



45
46
47
48
49
# File 'lib/rgeo/cartesian/calculations.rb', line 45

def side(point)
  px = point.x
  py = point.y
  (@sx - px) * (@ey - py) - (@sy - py) * (@ex - px)
end