bfoz / geometry

Geometric primitives for Ruby
https://rubygems.org/gems/geometry
BSD 2-Clause "Simplified" License
47 stars 18 forks source link

Add a rotation property to RegularPolygon #55

Open bfoz opened 11 years ago

bfoz commented 11 years ago

Generating the vertices requires knowing the angle of the first vertex, which would be equal to the rotation property. It currently assumes that the first vertex is on the X-axis, which is fine for most cases, but doesn't work when sides == 4 and isn't ideal for pentagons. Alternatively, special case those two situations.

bfoz commented 11 years ago

Alternatively, the rotation could be specified using an axis passing through the center of the polygon (using either a direction vector, or a point)