Triangle Mapping and Data Structures (Clojure)

Cover Image for Triangle Mapping and Data Structures (Clojure)
J.A. Covert
J.A. Covert

Triangle Pixel Mapping

Code Explanation

Displayed below are sample outputs generated by an image processing tool developed in Clojure. This tool employs a recursive approach to partition the canvas into triangles, with the depth of subdivision determined by user-defined parameters. During each function call, there exists a stochastic element that introduces a probability of the triangle division process terminating prior to reaching the specified depth.

Upon reaching the base level of subdivision, the algorithm strategically positions a node at the vertex of each triangle while meticulously recording connectivity information to adjacent vertices. This methodology enables the implementation of specialized search algorithms for expedient triangle retrieval.

Following the completion of the division process, the algorithm systematically traverses each individual triangle, aggregating all pixels residing within its confines, computing their average color values, and subsequently populating the triangle with the resultant color.

Sample Outputs

triangle1
triangle2
triangle3