Shapes & spaces

Quadric tangent cone calculator from an external viewpoint

Construct the quadratic cone of projective tangent directions from a finite viewpoint to a nonsingular quadric.

Your numbers

Symmetric 4×4 matrix for[x, y, z,1]Q[x, y, z,1]ᵀ=0; integer, short decimal or rational entries.
Use finite values within the stated calculator bounds.
Use finite values within the stated calculator bounds.

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your inputs and select Calculate.

Report an issue

Behind the numbers

How this calculation works

Construct the quadratic cone of projective tangent directions from a finite viewpoint to a nonsingular quadric.

THE FORMULAK=ggᵀ−f(p)A; g=Ap+b; dᵀKd=0 for f(x)=xᵀAx+2bᵀx+c.

A worked example

For the unit sphere and viewpoint (2,0,0), the cone matrix is diag(1,−3,−3). The default direction (−1,1,0) has cone value −2 and is not tangent.

Good to know

Nonsingular symmetric rational 4×4 homogeneous quadric, finite rational viewpoint off its surface, and nonzero test direction. Exact cone coefficients and direction test; resolved numerical inertia only. Near-singular unresolved classification is rejected; projective tangency at infinity is distinguished.

The tangent directions from one viewpoint

From a point outside a sphere, only a cone of directions grazes the surface instead of passing through it or missing it. A general quadric has an analogous quadratic condition on line directions. This page constructs that condition rather than merely classifying the original surface.

The cone concerns projective lines through the viewpoint. A direction and its negative describe the same line, so a tangent line can meet the quadric behind the viewpoint if interpreted as a forward ray. The calculator does not silently add a visibility or positive-travel requirement to this projective construction.

Tangents from an external sphere viewpointUnit sphereViewpoint (2,0,0)K = diag(1,−3,−3)Test d=(−1,1,0): −2
Scroll across to see the full diagram.
For p=(2,0,0), the cone condition is dx²−3 dy²−3 dz²=0.

Compare this with the Quadric surface classification calculator from a symmetric equation. Construct the quadratic cone of tangent rays from a viewpoint, instead of merely classify the original surface.

The homogeneous matrix convention

Enter a symmetric four-by-four matrix Q for the equation h transpose Q h equals zero, where h is x, y, z, one. Its upper-left block is A, its last spatial column is b, and its bottom-right entry is c. Off-diagonal spatial coefficients enter the expanded equation twice.

The finite viewpoint must not lie on the quadric. That case degenerates to its tangent-plane geometry and is deliberately excluded here. The homogeneous matrix must also be nonsingular; degenerate pairs of planes or cylinders with a singular projective form require another classification and are not silently treated as ordinary nonsingular quadrics.

A sphere gives a diagonal cone

For the unit sphere, the spatial block is the identity, b is zero and c is minus one. At viewpoint two-zero-zero, the quadric value is three and g is two-zero-zero. The resulting cone matrix is diagonal with entries one, minus three and minus three.

Thus a tangent direction satisfies dx squared equal to three times dy squared plus dz squared. The default direction minus-one, one, zero gives a cone value of minus two, so it is not tangent. A nonzero cone matrix with real directions does not mean every tested direction belongs to it.

Deriving the discriminant condition

Substitute the line p plus t d into the quadric equation. The result is a scalar quadratic in travel parameter t, whose coefficients are d transpose A d, two g dotted with d, and the quadric value at p. Ordinary tangency requires a repeated intersection parameter.

Setting the quadratic discriminant to zero gives the directional form g g transpose minus f of p times A. This derivation exposes both the factor-of-two convention and the possibility that the quadratic coefficient vanishes. The latter can describe projective tangency at infinity instead of a finite repeated contact.

Exact coefficients and a tested direction

Rational arithmetic constructs the cone matrix and evaluates a supplied direction exactly for the parsed numbers. A zero directional value is therefore an exact algebraic statement in that representation. If its quadratic line coefficient is nonzero, the repeated travel parameter and contact point are returned as rational values.

The overall matrix can be multiplied by any nonzero scalar without changing the cone. Comparing literal entries from another source is less useful than comparing the resulting zero set and incidence identities. Always match the original quadric's homogeneous coordinate and cross-term conventions first.

Real directions and conditioning

Whether a real nonzero direction exists depends on the cone form's inertia. Indefinite forms have real null directions, positive- or negative-definite forms do not, and singular semidefinite forms have nullspace directions. Numerical eigenvalues are used only when their sign classification is resolved.

A very small positive eigenvalue must not be called an exact zero just because it is small compared with another one. The implementation checks exact nonsingularity against that numerical ambiguity and rejects unresolved cases. It does not claim that a viewpoint inside a highly elongated ellipsoid has real tangents through a tolerance artifact.

Using the cone result carefully

Check a known tangent line by substituting its returned contact point into the original quadric and checking that the line direction lies in the tangent plane there. These are separate incidence tests, not merely another look at the discriminant. A nontangent direction should not receive a fabricated contact point.

Use the matrix to study apparent contours or tangent-line geometry under the stated assumptions. A cone can include directions irrelevant to a forward camera ray, an occluded surface patch or a chosen bounded portion of the quadric. Those application-specific restrictions require additional tests outside this algebraic page.

A few questions, answered

Does direction membership use a floating epsilon?

The parsed rational direction test is exact; the global real-direction inertia classification is numerical and rejects unresolved cases.

Can the viewpoint lie on the surface?

No. That tangent-plane degeneracy is outside this page's supported construction.

Does a tangent line have to point forward?

No. The construction uses projective line directions; positive travel and visibility are separate restrictions.

What is tangency at infinity?

It is a projective boundary case where the repeated contact is not a finite point on the entered line parameterization.

Find your calculator

Start typing to explore the library.