We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Particularly, we want to find the area of the circle centered in origin. Points in its perimeter are expressed as x * x + y * y = r * r, being r, the radius, and (x, y) a point of the circumference. Our known area is the graphic window of processing, then we'll translate the coordinate axis to the center of the circle. On that origin we'll draw a circle of radius r. Then we'll "throw" N points, and we'll count how many of them "land" inside the circle. (storing the number of points in a variable called "C") According to Monte Carlo: Area of the circle = (C / N) * (area of the graphic window). Then PI = (N / C * r * r) * (area of the graphic window).
The objective is to build a function that returns the apprx value of PI, given 3 parameters:
If the simulation is drawn, there must be a circle in the center of the graphic window, and random points, it they land inside the circle, they must be BLUE, otherwise, they'll be RED.
Can someone please help me do this?