Module: RGeo::Cartesian::PointMethods
- Included in:
- PointImpl
- Defined in:
- lib/rgeo/cartesian/feature_methods.rb
Overview
:nodoc:
Instance Method Summary collapse
Instance Method Details
#buffer(distance) ⇒ Object
56 57 58 59 60 61 62 63 64 |
# File 'lib/rgeo/cartesian/feature_methods.rb', line 56 def buffer(distance) point_count = factory.property(:buffer_resolution) * 4 angle = -::Math::PI * 2.0 / point_count points = (0...point_count).map do |i| r = angle * i factory.point(@x + distance * Math.cos(r), @y + distance * Math.sin(r)) end factory.polygon(factory.linear_ring(points)) end |