The problem I'm having is setting up a basic double integral in order to rasterize (display curves as squares to be displayed by pixels from a computer). For example, if I wanted to know the area of a circle of radius 3 where x=[1,2] and y=[2,3], I would think setting up the integral would be as easy as
$$\int_{1}^{2} \int_{2}^{\sqrt{9-x^2}} 1dydx$$
or
$$\int_{1}^{2} \int_{2}^{3} x^2+y^2-9dydx$$
but I can't seem to get a reasonable answer. My end goal is to repeat this process and find the area under the circle(and eventually any other curve) in each unit square on the x-y coordinate system so I may pixelize these shapes. Any help would be great.
There are actually a few integrals involved in this problem to cover multiple cases. Take a circle at radius 4 so we can hit all 4 of these cases.
Case 1: [3,4]x[0,1]
The curve crosses our unit square and inbeetween only 1 of our bounds either our X bound OR our Y bounds. In this case the integral can be set up like so: $$\int_{0}^{1} \int_{3}^{\sqrt{16-x^2}} 1dydx$$
Case 2: [2,3]x[2,3]
The curve crosses our unit square but does not cross either of our bounds. In this case the integral can be set up like so: $$\int_{2}^{\sqrt{16-3^2}} \int_{2}^{3} 1dydx + \int_{\sqrt{16-3^2}}^{3} \int_{2}^{\sqrt{16-x^2}}1dydx$$
Case 3: [1,2]x[2,3]
The curve does not cross our unit square and is contained between x and y bounds. This simply means that the entire unit square is filled so it would be pointless to set up an integral since our answer would be equal to 1.
$$1$$
Case 4: [0,1]x[4,5]
The curve does not cross our unit square and is not contained between x and y. This simply means that the entire unit square is not filled so it would be pointless to set up an integral since our answer would be equal to 0.
$$0$$
To do this all the way around the circle you would simply have to switch the bounds and multiply your values by -1 depending on what quadrant you're integrating in.
Ex: [-3,-3]x[0,1]
$$\int_{-1}^{0} \int_{3}^{\sqrt{16-x^2}} 1dydx$$
Ex: [-2,-3]x[2,3]
$$\int_{-\sqrt{16-3^2}}^{-2} \int_{2}^{3} 1dydx + \int_{-3}^{-\sqrt{16-3^2}} \int_{2}^{\sqrt{16-x^2}}1dydx$$
Of course in a circle these integrals are equal to their quadrant 1 counter parts but if a brute force algorithm this would be very handy and if a more complex curve was used to integrate under this would not be the case.