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

See also

Other Geometries: circle(), direction(), iso_cube(), iso_rect(), line(), plane(), point(), ray(), segment(), tetrahedron(), triangle(), vec(), weighted_point()

Other Volumes: iso_cube(), tetrahedron()


# Construction
p <- point(sample(8), sample(8), sample(8))
sphere(p, 4)
#> <3D euclid_spheres [8]>
#> [1] <x:4, y:8, z:3, r2:4> <x:8, y:1, z:8, r2:4> <x:7, y:7, z:5, r2:4>
#> [4] <x:2, y:3, z:2, r2:4> <x:6, y:4, z:6, r2:4> <x:5, y:6, z:4, r2:4>
#> [7] <x:3, y:5, z:1, r2:4> <x:1, y:2, z:7, r2:4>

sphere(p[1:2], p[3:4], p[5:6], p[7:8])
#> <3D euclid_spheres [2]>
#> [1] <x:5.27, y:5.13, z:3.17, r2:9.85> <x:4.89, y:1.76, z:5.03, r2:19.1>

sphere(p[1:2], p[3:4], p[5:6])
#> <3D euclid_spheres [2]>
#> [1] <x:4.63, y:5.77, z:4.43, r2:7.44> <x:4.92, y:1.75, z:4.99, r2:19.1>

sphere(p[1:2], p[3:4])
#> <3D euclid_spheres [2]>
#> [1] <x:5.5, y:7.5, z:4, r2:3.5> <x:5, y:2, z:5, r2:19>     

circ <- circle(p[1], as_vec(p[2]), 6)
#> <3D euclid_spheres [1]>
#> [1] <x:4, y:8, z:3, r2:6>