Please Help,
I am trying to find the center of a set of X, Y, Z coordinates in a given ASCII file. The file is formated like:
node_# X_coord Y_coord Z_coord
1 0.0023 2.32 1.34
2 3.21 9.23 3.21
...
The actual structure of the ASCII file could have the nodes/points in any arbitrary order. I thought about getting the max and min of the file and taking the mid-point but since the nodes could zig-zag around in placement, if I used the standard distance formula I might not get the actual maximum and minimum node/point.
I am a little “rusty” on geometry, so any help would be greatly appreciated.
Thanks.
You don’t have to search for the min/max node. Just search for the min/max x coordinate, the min/max y coordinate and the min/max z coordinate, all independant from each other. So the maximum x coordinate might be from another node as the maximum y and z coordinates.
I appologize for such a simple question and the question being unclear. I wasn’t thinking too clear at the time of the posting - my wife and I have a new baby, so sleep is sometimes a luxury we don’t have.
K_szczech, the distance function I was referring to was distance = sqrt((X1-X2)^2 + (Y1-Y2)^2 + (Z1-Z2)^2). This is why I believed that the distance would zig-zag around in an unordered and arbitrary coordinate file. I was wrong to think of this approach for such a simple problem, However thank you for your reply. I will try to keep in mind the clarity of my questions from now on.
Overmind, thank you for the reply also. Your suggestion is what I need, it is simple and that is all that is required for the problem.
Happy Holidays to all.