# Quads as Area Lights

A bit out of order, but this post will deal with my work on using quads for area lights. Okay, here's the deal, how do you pick a random point from the interior of a quadrilateral and ensure that the distribution is as uniform as possible? Good question ehh? My math prof thinks so too. We discussed several methods. We are doing this because we need to emit photons from the surface of the light.

The following pictures of distributions are plotted with 2500 points.

### Its easy to select a point inside the parallelogram defined by a triangle, so divide the quad into four triangles, pick a point inside each corresponding parallelogram and average them together. Nice and simple, but it creates a distribution that is obviously not uniform, it shows a strong bias for the center of the quad. To be fair, this was of my own invention. (The red, green, yellow, and cyan dots are from the four triangles, the blue are the actually points.)

### This method my math prof and I came up with. Since the definition of convex is that any two points picked on or in a convex shape, the line segment connecting those points is entirely contained in or on the shape. So we pick two random points along the edges of the quad, we then pick a random point along the line segment that connects those two points. This gives us the following distribution, which looks decent, but you can notice a bias for the edges. Which comes from the fact that the two edge points might fall on the same edge.

### Method C: Edge-Edge-Line Method - Second Try

This is the same method as above, Method B, but we add the restriction that the two points on the edges are not allowed to ever be on the same edge. We get this distribution which looks a lot better. Here are a couple more images. These are 20,000 points apiece. You can see that both Methods B and C work fairly well, but I'll choose Method C for my work.

### Method C: 