Results 1 to 6 of 6

Thread: Calculate Radius of a sphere

Threaded View

  1. #1

    Thread Starter
    PowerPoster Halsafar's Avatar
    Join Date
    Jun 2004
    Location
    Saskatoon, SK
    Posts
    2,339

    Calculate Radius of a sphere

    Okay...I got a node in a quad tree.

    I have 4 points which make up its bounding box..

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width