Jump to content
• Advertisement

# Simple Calculus problem: integrating over a line segment in 3D

This topic is 4821 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

## Recommended Posts

I probably should know this, but somehow I can't be sure of the answer to this problem. Surely it will be considered trivial by some of you in this forum :) I have a function f(x,y,z) in 3D space - the domain is R^3, and it returns a value in R. I need to find out how to integrate this function over a line segment, defined by 2 points. If you can just help me with this, I'll deal with the rest myself (actually integrating the function I have), so don't worry about that! I just want some pointers on how someone would go about doing this integration with any function. My hypothetical solution might be terribly wrong, so I won't post it for now, just in case someone gives me a quick reply. Thanks in advance!

#### Share this post

##### Share on other sites
Advertisement
I don't really know much about this stuff but I think you can represent your line as a parametric function and then express the value of the line in the 3d function as a composite function, and then integrate that. I think that would work but I really haven't done this stuff so...

#### Share this post

##### Share on other sites
f(x,y,z) is your function
a and b are the points.

the line segment between a and b may be parametrized as s(t) = (1-t)a + tb, t in [0,1].

So, to integrate you must do:

I(f(s(t))*norm(ds/dt)*dt) = I(f(s(t))*norm(a-b)dt), from 0 to 1.

I is the integrate signal.

#### Share this post

##### Share on other sites
read up on line integrals in a calculus book. are you solving this numarically?

#### Share this post

##### Share on other sites
Your problem is sampling the curve in space. Google for "Integration by quadrature" and "Monte Carlo integration".

-cb

#### Share this post

##### Share on other sites

• Advertisement
• Advertisement

• ### Popular Contributors

1. 1
2. 2
Rutin
15
3. 3
4. 4
5. 5
• Advertisement

• 9
• 9
• 14
• 12
• 10
• ### Forum Statistics

• Total Topics
633269
• Total Posts
3011153
• ### Who's Online (See full list)

There are no registered users currently online

×

## Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!