I'm writing an android application that scans an image and creates a sort of histogram from said image, then allows the user to drag a baseline of a predefined number of points. I have these parts completed, but now I need to be able to estimate the integral between the 1000 or so points from the scanned image and the user defined baseline consisting of any number of points, over a set interval(will probably be decided by an algorithm that decides where the max/mins are and inflection points). Each array of points define a single line.
Is there any existing library that will take Point[] arrays and find the estimated area between two lines? Or do I need to write a custom algorithm myself to handle this? I looked at apache common math, but it seemed to need a math function to be passed in to be able to find an integral.
edit:
line 1 is an array of about 1000 points(depends on image resolution)
{(0,5),(1,10), (2,11), (3,9), ....(1000,12)}
line 2 might be 5 points(user decides): {(0,5), (250,9), (500,7), (750,8), (1000,5)}
Real y-values will be much larger, but this is the general idea.
I'm not sure if I completely understand what you want, but if you'd like to find the area of a polygon defined by points resulting from your image and those from the user drawing a baseline you could use this very simple equation for the area of a non-intersecting polygon