hello everyone, i have an assignment is to write a C++ program that will calculate the potential distribution in a 10×10×10 environment containing obstacles. It will then find the shortest collision-free path for a flying robot from any given starting location to the target location.
My program should read the (starting location) , (the target location) , and (the obstacle locations) from a text file.
It will then calculate the potential distribution, use it to generate the path, and store the path in another text file.
***it is challenging assignment and i'm not sure how can i read 3d Arrays from file and how to write a function using Gauss-Seidel Method in 3d.
Pretty well the same way as you would read anything else from file. It simply depends on what information is in the file and how it is set out in that file.
Gauss-Seidel Method in 3d.
Gauss-Seidel is just an iterative method for solving a set of coupled equations (making each variable - e.g. element of an array - the subject of its equation and repeatedly cycling through the set of equations). Depends what equations you want to solve.
the potential distribution
"Potential" what? Potential energy? Electrostatic potential? Most "potential" equations are of the form (with partial derivatives):
d^2 phi / dx^2 + d^2 phi / dy^2 + d^2 phi / dz^2 = S
There are standard discretisations for those second derivatives. What matters is the source term S and the boundary conditions.
One thing is for sure - you need to decide what equations you intend to solve (and probably how you are going to discretise them) before you start any coding.