Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 203 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
203
Dung lượng
7,2 MB
Nội dung
Chapter Advanced Graphics Algorithms An algorithm is a computational procedure for addressing a problem in a finite number of steps In the world of design, and in particular, architecture, the problems designers are called upon to solve are not necessarily solvable in the traditional sense of finding a path between A and B Apart from specific quantitative localized sub-problems that occur within some standardized patterns of construction, the general formal, aesthetic, or planning considerations are barely addressable as discrete solvable problems Consequently, it may be more appropriate to use the term problem addressing rather than problem solving in order to characterize the solution strategy Contrary to common belief, algorithms are not always based on a solution strategy conceived entirely in the mind of a human programmer Many algorithms are simulations of the way that natural processes work and as such they must not be regarded as human inventions but rather as human discoveries Unlike inventions, discoveries are not conceived, owned, or controlled by the human mind, yet as abstract processes they can be codified to be executed by a computer system In this case, the human programmer serves the purpose of codifying a process, that is, a translator of a process external to the human mind to be compiled into machine language, which is also external to the human mind In this chapter, we will present a series of algorithms that although not directly conceived, constructed, or applied for design purposes, can be used indirectly to address design issues A Voronoi tessellation, stochastic search, 153 154 Chapter n Advanced Graphics Algorithms hybridization, fractals, cellular automata, and evolutionary algorithms are just a few of the algorithms that can be used to address design issues 7.1 Voronoi Tessellation A Voronoi tessellation is the partitioning of a plane into sets of points, each set based on their points’ position from a set of marked points All points closest to the mark are considered sets of a Voronoi tessellation For instance, if two pixels are marked in a computer screen, they will produce two areas that will divide all pixels into those that are closest to either one of the two points These two areas will be bordered by a straight line, dividing the pixels of the screen into these two areas This line, of course, is perpendicular to the line connecting the two marked points (See Figure 7-1.) Figure 7-1: A Voronoi tessellation The problem of the Voronoi tessellation can be addressed in at least in two ways: either by finding the lines and their intersections that divide the plane into areas or by coloring each pixel of the plane based on its proximity to a mark In other words, the problem can be solved either as an analytical geometrical problem or as a finite element problem In this section, we will use the second method: float [] px = new float[0]; // hold the mouse pressed marks float [] py = new float[0]; float [] distance = new float[0]; //holds the pixel’s distance to the marked point int [] idx = new int[0]; //used for sorting the pixels Chapter n Advanced Graphics Algorithms PImage MyImage; void setup(){ size (400,400); MyImage = createImage (width, height, RGB); //create an image image(MyImage,0,0); 10 } 11 void draw(){ 12 stroke(0); 13 for(int i=0; i