LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-26-2004, 01:13 PM   #1
fisheromen1031
Member
 
Registered: Jun 2004
Location: Lone Star State
Distribution: WinXP Pro, Puppy Linux, Ubuntu Warty & Hoary
Posts: 46

Rep: Reputation: 15
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

Last edited by fisheromen1031; 06-26-2004 at 02:04 PM.
 
Old 06-26-2004, 04:28 PM   #2
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
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.
 
Old 06-26-2004, 04:42 PM   #3
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
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...
 
Old 06-26-2004, 05:16 PM   #4
fisheromen1031
Member
 
Registered: Jun 2004
Location: Lone Star State
Distribution: WinXP Pro, Puppy Linux, Ubuntu Warty & Hoary
Posts: 46

Original Poster
Rep: Reputation: 15
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
 
Old 06-26-2004, 10:09 PM   #5
jwstric2
Member
 
Registered: Jan 2004
Posts: 105

Rep: Reputation: 15
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Calculate in shell script Ephracis Linux - General 1 12-16-2004 11:11 AM
Calculate the space of a folder Half_Elf Linux - General 4 05-18-2003 07:53 PM
calculate traffic using iptables p_nanda2002 Linux - Software 4 11-01-2002 02:51 AM
cbq isolated bounded not working in linux7.1 cybercop12us Linux - Newbie 0 10-08-2001 12:54 AM
CBQ - bounded ,isolated not working in Linux7.1 cybercop12us Linux - Networking 0 10-08-2001 12:43 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:04 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration