Center of model Coordinates

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.

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.
This part of your post is very unclear.
If you use min/max then you get bounding box of entire object and mid-point would be the center of all coordinates.
I don’t know why do you think random order has anything to do here.
I also don’t understand what kind of distance function are you referring to. If you use min-max and then just take mid-point then there is no single operation in such algorithm that would require any distance function.
Please clarify.

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.

maybe http://en.wikipedia.org/wiki/Centroid

Originally posted by Ray Tayek:
maybe http://en.wikipedia.org/wiki/Centroid
Centroid is something different than a simple center of a set of points. Centroid is more like a center of gravity, which is not what is discussed here, I believe.