Course:CPSC312-2016-Project1-drawlog

From UBC Wiki

Title

Authors: Andrew Adair Comminos, Lorien Hu, Shakthi Wijeratne

What is the problem?

Prolog doesn't allow me to express my inner artistic talent by drawing primitive shapes and it makes me sad. (We want to be able to draw easily using logic programming.)

What is the something extra?

Drawlog will allow us to represent 2D rasterization using logic programming.

We would like the ability to define primitive shapes in 2-space using definite clauses such as;

   - shape(x,y,z,fill).
   - rect(x0, y0, x1, y1, fill).
   - line(x0, y0, x1, y1, fill).
   - tri(x0, y0, x1, y1, x2, y2, fill).
   - almond(x, y, length)

For each pixel

   - Resolve which shapes fill the point
   - Color pixel accordingly
   - e.g. fills(X, Y, Color) checks all shapes intersecting (X,Y)

What did we learn from doing this?

PPM that was generated by Prolog. Converted to JPEG since mediaWki could not accept PPMs

The main thing that we have learned from this project is to define geometry using a set of logical constraints. Additionally, by implementing a simple rasterization technique, we have a practical understanding of how graphics cards work.

Even though it wasn't a part of our original goal, we did not have the time to implement sorting the shapes by a given Z value. This was supposed to make sure that the shapes drawn were overlaid in the proper order.

Prolog is suitable for fragment based-rasterization so it is suitable for this application when it comes to feasibility. Two issues, however, that we ran into were inefficient sorting and stack space being too low.