From love.math.triangulate : Decomposes a simple convex or concave polygon into triangles. [...] table polygon Polygon to triangulate. Must not intersect itself. A simple polygon is one that does not intersect itself and has no holes. I don't know what algorithm triangulate uses Kong's triangulation...

-> How can I get the color of a given pixel in a texture sent to the shader? Suppose I send a drawn canvas to the shader. How can I get the color of a certain pixel on this canvas? As grump wrote, the Texel() function does what you want, but keep in mind that shaders work "inside out": They are lit...

From the PIL, chapter 17 : Lua does automatic memory management. A program only creates objects (tables, functions, etc.); there is no function to delete objects . Lua automatically deletes objects that become garbage, using garbage collection. You need to remove all references to the object, that m...

Shameless plug: Here is how to do it with SUIT . The important part is in the validate function, which uses string.gsub() to remove unwanted characters. You can do anything you like here. local suit = require 'suit' local utf8 = require 'utf8' local function validate(input) local len = utf8.len(inpu...

Fun project that leaves room for so much experimentation. Here are a few suggestions: For the neural net: Use different activation function, for example ReLU, leaky ReLU, sinc, etc. ( here is a list ). How do the different activation functions affect how fast the computer learns to play the game? Us...

TL;DR: shine version 2.0: Better API, better performance, better name. Less than 10 lines of code to transform this: noonshine.jpg into this: moonshine.jpg Lövers, ever since shaders were first added to LÖVE , I had this idea of a vast repository of common post-processing shaders that you could jus...

I was curious, so I did my own test. I also computed the variation in run time to get a sense if the difference is (statistically) significant. This is the code I used: -- compute mean and standard deviation from sample local function mean_std(t) assert(#t >= 2) local mean, scatter = 0, 0 for n,x in...

The PIL teaches you everything there is to know about Lua and is (in my opinion) one of the best books about programming languages in general. It's a bit dense, but given that you already know other programming languages that should be no problem.

I'm afraid you will have to check every polygon. However, you can speed up the intersection tests by computing the outcircle of each polygon (has to be done only once) and test whether the outcircles intersect (centroid-distance < sum-of-radii). If they don't, you know the polygons will not share a ...