A sphere is a 3 dimensional object modelling the surface of a ball. As such it is an extension of the concept of a 2 dimensional circle to 3D, though a circle can also exist in three dimensions. A sphere has a center and a radius. if the radius is 0 it is considered to be degenerate.






Various input. See the Constructor section.


A vector of spheres or an object to convert to it


An euclid_sphere vector


3 dimensional spheres

  • Providing 4 points will construct the unique sphere the passes through all 4 points (points must not be coplanar)

  • Providing 3 points will construct the smallest sphere that passes through all 3 points

  • Providing 2 points will construct the smallest sphere passing through both points

  • Providing a point and numeric will construct spheres centered on the point with a squared radius set to the numeric

  • Providing a circle will construct the diametral sphere of the circle


# Construction p <- point(sample(8), sample(8), sample(8)) sphere(p, 4)
#> <3D euclid_spheres [8]> #> [1] <x:8, y:7, z:7, r2:4> <x:5, y:1, z:5, r2:4> <x:3, y:5, z:2, r2:4> #> [4] <x:4, y:2, z:1, r2:4> <x:2, y:8, z:8, r2:4> <x:6, y:3, z:4, r2:4> #> [7] <x:7, y:4, z:6, r2:4> <x:1, y:6, z:3, r2:4>
sphere(p[1:2], p[3:4], p[5:6], p[7:8])
#> <3D euclid_spheres [2]> #> [1] <x:4.51, y:6.96, z:5.1, r2:15.8> <x:2.61, y:3.14, z:3.88, r2:11.5>
sphere(p[1:2], p[3:4], p[5:6])
#> <3D euclid_spheres [2]> #> [1] <x:4.47, y:6.49, z:5.33, r2:15.5> <x:4.64, y:1.69, z:3.01, r2:4.55>
sphere(p[1:2], p[3:4])
#> <3D euclid_spheres [2]> #> [1] <x:5.5, y:6, z:4.5, r2:13.5> <x:4.5, y:1.5, z:3, r2:4.5>
circ <- circle(p[1], as_vec(p[2]), 6) sphere(circ)
#> <3D euclid_spheres [1]> #> [1] <x:8, y:7, z:7, r2:6>