Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. code to estimate center of sphere?

code to estimate center of sphere?

Scheduled Pinned Locked Moved C / C++ / MFC
question
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 2080501
    wrote on last edited by
    #1

    Are there any codes out there that helps me to estimate or calculate the center of a sphere from a set of data points on the surface of the sphere? for eg., least-squares fitting of a set of points to the equation of a sphere? THANKS!

    V E 3 Replies Last reply
    0
    • U User 2080501

      Are there any codes out there that helps me to estimate or calculate the center of a sphere from a set of data points on the surface of the sphere? for eg., least-squares fitting of a set of points to the equation of a sphere? THANKS!

      V Offline
      V Offline
      V 0
      wrote on last edited by
      #2

      mm don't know any code but if I'm not mistaken the radius is in the equation correct? this means you have the distance of each point on the sphere to the center. take to points and calculate which point is on distance = radius to the two known points. If you don't know your formulas, search the net. you need the equation of the sphere and the equations for calculating the distances. (Don't know it by heart sorry, it 's something with roots and power to two etc) good luck. No hurries, no worries.

      1 Reply Last reply
      0
      • U User 2080501

        Are there any codes out there that helps me to estimate or calculate the center of a sphere from a set of data points on the surface of the sphere? for eg., least-squares fitting of a set of points to the equation of a sphere? THANKS!

        E Offline
        E Offline
        erkanina
        wrote on last edited by
        #3

        At first I tried to remember 3D math, surface equations and surface normals But solution is easy if I do not misunderstand You have limited sample points (x,y,z) of a sphere. Search all samples and obtain Minimim and Maximum value of X,Y,Z; The center of the sphere is (Xcenter,Ycenter,Zcenter) The equation should be so; Xcenter = (Xmin + Xmax) / 2 Ycenter = (Ymin + Ymax) / 2 Zcenter = (Zmin + Zmax) / 2 I hope it helps you

        1 Reply Last reply
        0
        • U User 2080501

          Are there any codes out there that helps me to estimate or calculate the center of a sphere from a set of data points on the surface of the sphere? for eg., least-squares fitting of a set of points to the equation of a sphere? THANKS!

          E Offline
          E Offline
          erkanina
          wrote on last edited by
          #4

          Or you can apply clasiccal method; You should have at least three surface point to obtain a sphere. (Xo,Yo,Zo) is center coordiane of sphere and r is half of diameter Sphere equation is (X - Xo)^2 + (Y - Yo)^2 + (Z - Zo)^2 = r^2 We have 3-samples Sample1 : (X1,Y1,Z1) Sample2 : (X2,Y2,Z2) Sample3 : (X3,Y3,Z3) Place these three sample to the above equation, and then you will obtain 3 equation with unknown Xo,Yo,Zo parameters. You can easily calculate these with three equation.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups