Skip to contents

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.

Usage

sphere(...)

is_sphere(x)

as_sphere(x)

Arguments

...

Various input. See the Constructor section.

x

A vector of spheres or an object to convert to it

Value

An euclid_sphere vector

Constructors

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()

Examples

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

sphere(p[1:2], p[3:4], p[5:6], p[7:8])
#> <3D euclid_spheres [2]>
#> [1] <x:4.41, y:4.46, z:6.19, r2:13.8> <x:-14.9, y:3.9, z:19.3, r2:624> 

sphere(p[1:2], p[3:4], p[5:6])
#> <3D euclid_spheres [2]>
#> [1] <x:4.37, y:4.07, z:6.84, r2:13.2> <x:3.32, y:-4.2, z:13.2, r2:190> 

sphere(p[1:2], p[3:4])
#> <3D euclid_spheres [2]>
#> [1] <x:3, y:2, z:5.5, r2:5.25>   <x:4.5, y:5, z:4.5, r2:27.5>

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