[solved] Unpredictable error triangulating a polygon
Posted: Thu Nov 30, 2017 2:50 pm
I hope someone can help me.
I have some code that draws a graph, it gives an error when I call love.math.triangulate. I have boiled the code down to this contrived example for demonstration purposes:
The error appears when I uncomment the line noted in the code. I am scratching my head on this one folks
I have some code that draws a graph, it gives an error when I call love.math.triangulate. I have boiled the code down to this contrived example for demonstration purposes:
Code: Select all
function love.load()
vertices = {
0, 138,
20, 138,
41, 144,
62, 162,
82, 181,
103, 181,
124, 191,
--144, 192, -- THINGS START GOING WRONG HERE :(
--165, 195,
--186, 196
}
triangles = love.math.triangulate ( vertices )
end
function love.draw()
love.graphics.setLineJoin("none")
for triNo, triangle in ipairs ( triangles ) do
love.graphics.polygon ( "fill", triangle )
end
end
function love.keypressed()
love.event.quit()
end