ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
Last edited by fisheromen1031; 06-26-2004 at 02:04 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.
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...
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
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.