In geometry, the midsphere or intersphere of a convex polyhedron is a sphere which is tangent to every edge of the polyhedron. Not every polyhedron has a midsphere, but the uniform polyhedra, including the regular, quasiregular and semiregular polyhedra and their duals all have midspheres. The radius of the midsphere is called the midradius. A polyhedron that has a midsphere is said to be midscribed about this sphere. 
When a polyhedron has a midsphere, one can form two perpendicular circle packings on the midsphere, one corresponding to the adjacencies between vertices of the polyhedron, and the other corresponding in the same way to its polar polyhedron, which has the same midsphere. The length of each polyhedron edge is the sum of the distances from its two endpoints to their corresponding circles in this circle packing.
For every convex polyhedron there is a combinatorially equivalent polyhedron, the canonical polyhedron, that does have a midsphere, centered at the centroid of the points of tangency of the edges. Numerical approximation algorithms can construct it, but its coordinates cannot be represented exactly as a closed-form expression. Any canonical polyhedron and its polar dual can be used to form two opposite faces of a four-dimensional antiprism.
A midsphere of a three-dimensional convex polyhedron is defined to be a sphere that is tangent to every edge of the polyhedron. That is to say, each edge must touch it, at an interior point of the edge, without crossing it. Equivalently, it is a sphere that contains the inscribed circle of every face of the polyhedron.  When a midsphere exists, it is unique. Not every convex polyhedron has a midsphere; to have a midsphere, every face must have an inscribed circle (that is, it must be a tangential polygon), and all of these inscribed circles must belong to a single sphere. For example, a rectangular cuboid has a midsphere only when it is a cube, because otherwise it has non-square rectangles as faces, and these do not have inscribed circles. 
For a unit cube centered at the origin of the Cartesian coordinate system, with vertices at the eight points , the midpoints of the edges are at distance from the origin. Therefore, for this cube, the midsphere is centered at the origin, with radius . This is larger than the radius of the inscribed sphere, , and smaller than the radius of the circumscribed sphere, . More generally, for any Platonic solid of edge length , the midradius is 
The uniform polyhedra, including the regular, quasiregular and semiregular polyhedra and their duals all have midspheres. In the regular polyhedra, the inscribed sphere, midsphere, and circumscribed sphere all exist and are concentric,  and the midsphere touches each edge at its midpoint. 
Not every irregular tetrahedron has a midsphere. The tetrahedra that have a midsphere have been called "Crelle's tetrahedra"; they form a four-dimensional subfamily of the six-dimensional space of all tetrahedra (as parameterized by their six edge lengths). More precisely, Crelle's tetrahedra are exactly the tetrahedra formed by the centers of four spheres that are all externally tangent to each other. In this case, the six edge lengths of the tetrahedron are the pairwise sums of the four radii of these spheres.  The midsphere of such a tetrahedron touches its edges at the points where two of the four generating spheres are tangent to each other, and is perpendicular to all four generating spheres. 
If O is the midsphere of a convex polyhedron P, then the intersection of O with any face of P is a circle that lies within the face, and is tangent to its edges at the same points where the midsphere is tangent. Thus, each face of P has an inscribed circle, and these circles are tangent to each other exactly when the faces they lie in share an edge. (Not all systems of circles with these properties come from midspheres, however.) 
Dually, if v is a vertex of P, then there is a cone that has its apex at v and that is tangent to O in a circle; this circle forms the boundary of a spherical cap within which the sphere's surface is visible from the vertex. That is, the circle is the horizon of the midsphere, as viewed from the vertex. The circles formed in this way are tangent to each other exactly when the vertices they correspond to are connected by an edge. 
If a polyhedron P has a midsphere O, then the polar polyhedron with respect to O also has O as its midsphere. The face planes of the polar polyhedron pass through the circles on O that are tangent to cones having the vertices of P as their apexes.  The edges of the polar polyhedron have the same points of tangency with the midsphere, at which they are perpendicular to the edges of P. 
For a polyhedron with a midsphere, it is possible to assign a real number to each vertex (the power of the vertex with respect to the midsphere) that equals the distance from that vertex to the point of tangency of each edge that touches it. For each edge, the sum of the two numbers assigned to its endpoints is just the edge's length. For instance, Crelle's tetrahedra can be parameterized by the four numbers assigned in this way to their four vertices, showing that they form a four-dimensional family. 
As an example, the four points (0,0,0), (1,0,0), (0,1,0), and (0,0,1) form one of Crelle's tetrahedra, with three isosceles right triangles and one equilateral triangle for a face. These four points are the centers of four pairwise tangent spheres, with radii for the three nonzero points on the equilateral triangle and for the origin. These four numbers (three equal and one smaller) are the four numbers that parameterize this tetrahedron. Three of the tetrahedron edges connect two points that both have the larger radius; the length of these edges is the sum of these equal radii, . The other three edges connect two points with different radii summing to one.
When a polyhedron with a midsphere has a Hamiltonian cycle, the sum of the lengths of the edges in the cycle can be subdivided in the same way into twice the sum of the powers of the vertices. Because this sum of powers of vertices does not depend on the choice of edges in the cycle, all Hamiltonian cycles have equal lengths. 
One stronger form of the circle packing theorem, on representing planar graphs by systems of tangent circles, states that every polyhedral graph can be represented by the vertices and edges of a polyhedron with a midsphere. Equivalently, any convex polyhedron can be transformed into a combinatorially equivalent form, with corresponding vertices, edges, and faces, that has a midsphere. The horizon circles of the resulting polyhedron can be transformed, by stereographic projection, into a circle packing in the Euclidean plane whose intersection graph is the given graph: its circles do not cross each other and are tangent to each other exactly when the vertices they correspond to are adjacent.  Although every polyhedron has a combinatorially equivalent form with a midsphere, some polyhedra do not have any equivalent form with an inscribed sphere, or with a circumscribed sphere. 
Any two convex polyhedra with the same face lattice and the same midsphere can be transformed into each other by a projective transformation of three-dimensional space that leaves the midsphere in the same position. This transformation leaves the sphere in place, but moves points within the sphere according to a Möbius transformation.  Any polyhedron with a midsphere, scaled so that the midsphere is the unit sphere, can be transformed in this way into a polyhedron for which the centroid of the points of tangency is at the center of the sphere. The result of this transformation is an equivalent form of the given polyhedron, called the canonical polyhedron, with the property that all combinatorially equivalent polyhedra will produce the same canonical polyhedra as each other, up to congruence.  A different choice of transformation takes any polyhedron with a midsphere into one that maximizes the minimum distance of a vertex from the midsphere. It can be found in linear time, and the canonical polyhedron defined in this alternative way has maximal symmetry among all combinatorially equivalent forms of the same polyhedron.  For polyhedra with a non-cyclic group of orientation-preserving symmetries, the two choices of transformation coincide.  For example, the canonical polyhedron of a cuboid, defined in either of these two ways, is a cube, with the distance from its centroid to its edge midpoints equal to one and its edge length equal to . 
A numerical approximation to the canonical polyhedron for a given polyhedral graph can be constructed by representing the graph and its dual graph as perpendicular circle packings in the Euclidean plane,  applying a stereographic projection to transform it into a pair of circle packings on a sphere, searching numerically for a Möbius transformation that brings the centroid of the crossing points to the center of the sphere, and placing the vertices of the polyhedron at points in space having the dual circles of the transformed packing as their horizons. However, the coordinates and radii of the circles in the circle packing step can be non-constructible numbers that have no exact closed-form expression using arithmetic and nth-root operations. 
Alternatively, a simpler numerical method for constructing the canonical polyhedron proposed by George W. Hart works directly with the coordinates of the polyhedron vertices, adjusting their positions in an attempt to make the edges have equal distance from the origin, to make the points of minimum distance from the origin have the origin as their centroid, and to make the faces of the polyhedron remain planar. Unlike the circle packing method, this has not been proven to converge to the canonical polyhedron, and it is not even guaranteed to produce a polyhedron combinatorially equivalent to the given one, but it appears to work well on small examples. 
The canonical polyhedron and its polar dual can be used to construct a four-dimensional analogue of an antiprism, one of whose two opposite faces is combinatorially equivalent to any given three-dimensional polyhedron. It is unknown whether every three-dimensional polyhedron can be used directly as a face of a four-dimensional antiprism, without replacing it by its canonical polyhedron, but it is not always possible to do so using both an arbitrary three-dimensional polyhedron and its polar dual. 
The midsphere in the construction of the canonical polyhedron can be replaced by any smooth convex body. Given such a body, every polyhedron has a combinatorially equivalent realization whose edges are tangent to this body. This has been described as "caging an egg": the smooth body is the egg and the polyhedral realization is its cage.  Moreover, fixing three edges of the cage to have three specified points of tangency on the egg causes this realization to become unique.