I can get the center of the 4 points easily. That center can be used as the center of the sphere.
I am wondering how I can get the radius which would indeed cover those four points, or at least just past those 4 points. The sphere in most case's should be a bit bigger I think.
Any help at all though?
So far what I am doing is taking the magnitude of the a vector and dividing it by 2.
That works in most cases's...see
P1 (4,0) P3 (8,0)
P2 (4,4) P4 (8,4)
Center = ((P4 - P1) / 2) + P1 = (4,4 / 2) + 4,0 = (2,2) + (4,0) = 6,2
Center = 6,2 is indeed correct if you wish to picture the grid.
r^2 = x^2 + z^2 (the points I shall use will be from P4)
r^2 = 8^2 + 4^2
r^2 = 64 + 4
SqrRt(r) = SqrRt(68)
r = 8.2462112512353210996428197119482 / 2
r = 4.1231056256176605498214098559741
Indeed r as 4.1 is JUST outside the bounding box...is this correct????
Last edited by Halsafar; Jan 2nd, 2005 at 11:27 PM.
"From what was there, and was meant to be, but not of that was faded away." - - Steve Damm
"The polar opposite of nothingness is existance. When existance calls apon nothingness it shall return to nothingness." - - Steve Damm
"When you do things right, people won't be sure if you did anything at all." - - God from Futurama
After reading through you post, we need some clarification here.
1) Is your "bounding box" always square (or even rectangular) as in your example?
2) Are you looking for the smallest circle that encompasses all four points?
3) You suggest that the circle might need to be "a bit bigger" to take in the points, how much bigger?
Incidentally, if you are looking for the smallest circle whose radius takes in all four points, your calculated radius should be SqrRt(8).
I guess, as wossname suggested, your needs are a little unclear. Anything you can add will be of help.
This picture should help.
The radius is what I need to find.
The center of the node is easy.
The radius that encompas's past the 4 points....So the entire box is in the sphere.
"From what was there, and was meant to be, but not of that was faded away." - - Steve Damm
"The polar opposite of nothingness is existance. When existance calls apon nothingness it shall return to nothingness." - - Steve Damm
"When you do things right, people won't be sure if you did anything at all." - - God from Futurama