vrld / HC

General purpose collision detection library for the use with LÖVE.
http://hc.readthedocs.org/
402 stars 48 forks source link

Outcircle not working as expected #19

Closed markandgo closed 12 years ago

markandgo commented 12 years ago

The outcircle function is not returning a "circumscribing circle". Also when scaling a polygon, the size of the circle is not updated.

I think this function is problematic because not all shapes can have a circumscribing circle. Perhaps replace this function with a minimally bounded circle? Maybe even removing it would be a good idea.

shapes = require'hc.shapes'
shape = shapes.newPolygonShape(250,100,550,200,450,200)
shape:scale(2)
shape2 = shapes.newPolygonShape(250,100,550,200,450,200)

function love.draw()
    shape:draw('line')
    love.graphics.circle('line',shape:outcircle())
    shape2:draw('line')
    love.graphics.circle('line',shape2:outcircle())
end
vrld commented 12 years ago

You're right, it's not a circumscribing circle, but rather a sort of minimal circle that fully contains the shape. I will fix the documentation to avoid further confusion.