LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   calculate area bounded by points (https://www.linuxquestions.org/questions/programming-9/calculate-area-bounded-by-points-198001/)

fisheromen1031 06-26-2004 01:13 PM

calculate area bounded by points
 
I need to write a function to calculate the area bounded by a set of points. the catch is i don't just want the connect-the-dots area. the points will be connected by a spline curve. I want all of this area bounded by the curve.
This seems like a problem that has a good algorithm but i haven't found one yet.
can anybody help me?

God bless

PS i'm using gcc

Dark_Helmet 06-26-2004 04:28 PM

I'm sorry, I don't have an answer for you... at least not what you're hoping for.

I don't know a thing about splines except that they are curves connecting a series of points as you describe, and that they can form concave shapes (like a 'C' for instance).

Given those traits, it's no trivial thing to come up with an algorithm to calculate that bounded space. When dealing with an arbitrary number of points, more than likely, you'll end up dealing with calculus and integration. To do that, you would need to find the equation(s) of the spline(s) making up the surface. So now, you're also talking about non-linear regression, and the headaches associated with potential concave structures.

It might be conceptually possible, but implementation would be a nightmare using traditional mathematical analysis (i.e. what I was taught in school). Maybe there's some sort of special mathematical property about splines that I'm not aware of. I am all-ears if someone knows of it, but I just don't think there's an easy solution.

acid_kewpie 06-26-2004 04:42 PM

Not quite how your choice of C compiler relates at all to geometric algorithms but hey ho...

You've really given very little useful information... Where do these points exist? where does this curve come from? unless you want to find an integration routine I would believe that your best approach is to manually integrate along the curve, start on one side of the shape and work out the height of each strip, adding them as you go...

it's no easy thing to explain though, especially for someone who did his graphics courses 2 years ago... and never understood it at the time...

fisheromen1031 06-26-2004 05:16 PM

my professor is working on a 2-D fluid dynamics problem. i've only been told to do this task. the shape starts at some point 'traces' out a blob of liquid and connects back up where it started. but keep in mind that this from a finite set of points.

Thanks

b.t.w. the gcc thing was in case anyone knew of header files for any appropraite functions that might be included with that compiler

jwstric2 06-26-2004 10:09 PM

2-D, well that should be as bad as a 3-D. Its been a while since I had numerical analysis, so if you haven't gotten an answer soon I can pull out my old notes again. Have you tried using tools such as maple or matlab yet??? Most institutions have these applications and you could just write a couple of scripts to convert it to either of the programs's accepted data.

I would check into the open source graphics libraries and do a little digging to see if there's anything of interest in there.


All times are GMT -5. The time now is 06:58 AM.