HOME

TheInfoList



OR:

In analytic geometry, a
line Line most often refers to: * Line (geometry), object with zero thickness and curvature that stretches to infinity * Telephone line, a single-user circuit on a telephone communication system Line, lines, The Line, or LINE may also refer to: Art ...
and a
sphere A sphere () is a Geometry, geometrical object that is a solid geometry, three-dimensional analogue to a two-dimensional circle. A sphere is the Locus (mathematics), set of points that are all at the same distance from a given point in three ...
can
intersect Intersection or intersect may refer to: * Intersection in mathematics, including: ** Intersection (set theory), the set of elements common to some collection of sets ** Intersection (geometry) ** Intersection theory * Intersection (road), a pl ...
in three ways: # No intersection at all # Intersection in exactly one point # Intersection in two points. Methods for distinguishing these cases, and determining the
coordinates In geometry, a coordinate system is a system that uses one or more numbers, or coordinates, to uniquely determine the position of the points or other geometric elements on a manifold such as Euclidean space. The order of the coordinates is si ...
for the points in the latter cases, are useful in a number of circumstances. For example, it is a common calculation to perform during ray tracing.


Calculation using vectors in 3D

In
vector notation In mathematics and physics, vector notation is a commonly used notation for representing vectors, which may be Euclidean vectors, or more generally, members of a vector space. For representing a vector, the common typographic convention is ...
, the equations are as follows: Equation for a
sphere A sphere () is a Geometry, geometrical object that is a solid geometry, three-dimensional analogue to a two-dimensional circle. A sphere is the Locus (mathematics), set of points that are all at the same distance from a given point in three ...
:\left\Vert \mathbf - \mathbf \right\Vert^2=r^2 :*\mathbf : points on the sphere :*\mathbf : center point :*r : radius of the sphere Equation for a line starting at \mathbf :\mathbf=\mathbf + d\mathbf :*\mathbf : points on the line :*\mathbf : origin of the line :*d : distance from the origin of the line :*\mathbf : direction of line (a non-zero vector) Searching for points that are on the line and on the sphere means combining the equations and solving for d, involving the
dot product In mathematics, the dot product or scalar productThe term ''scalar product'' means literally "product with a scalar as a result". It is also used sometimes for other symmetric bilinear forms, for example in a pseudo-Euclidean space. is an alg ...
of vectors: :Equations combined ::\left\Vert \mathbf + d\mathbf - \mathbf \right\Vert^2=r^2 \Leftrightarrow (\mathbf + d\mathbf - \mathbf) \cdot (\mathbf + d\mathbf - \mathbf) = r^2 :Expanded and rearranged: ::d^2(\mathbf\cdot\mathbf)+2d mathbf\cdot(\mathbf-\mathbf)(\mathbf-\mathbf)\cdot(\mathbf-\mathbf)-r^2=0 :The form of a
quadratic formula In elementary algebra, the quadratic formula is a formula that provides the solution(s) to a quadratic equation. There are other ways of solving a quadratic equation instead of using the quadratic formula, such as factoring (direct factoring, g ...
is now observable. (This quadratic equation is an instance of Joachimsthal's equation.) ::a d^2 + b d + c = 0 :where :*a=\mathbf\cdot\mathbf=\left\Vert\mathbf\right\Vert^2 :*b=2 mathbf\cdot(\mathbf-\mathbf)/math> :*c=(\mathbf-\mathbf)\cdot(\mathbf-\mathbf)-r^2=\left\Vert\mathbf-\mathbf\right\Vert^2-r^2 :Simplified ::d=\frac = \frac :Note that in the specific case where \mathbf is a unit vector, and thus \left\Vert\mathbf\right\Vert^2=1, we can simplify this further to (writing \hat instead of \mathbf to indicate a unit vector): ::\nabla= hat\cdot(\mathbf-\mathbf)2-(\left\Vert\mathbf-\mathbf\right\Vert^2-r^2) ::d=- hat\cdot(\mathbf-\mathbf)\pm \sqrt :*If \nabla < 0, then it is clear that no solutions exist, i.e. the line does not intersect the sphere (case 1). :*If \nabla = 0, then exactly one solution exists, i.e. the line just touches the sphere in one point (case 2). :*If \nabla > 0, two solutions exist, and thus the line touches the sphere in two points (case 3).


See also

* Intersection_(geometry)#A_line_and_a_circle * Analytic geometry * Line–plane intersection * Plane–plane intersection * Plane–sphere intersection


References

{{DEFAULTSORT:Line-sphere intersection Analytic geometry Geometric algorithms Geometric intersection Spherical geometry