The Complexity of Geometric Problems

In an algorithms design course, you learned complexity measures of algorithms. For example, an optimal sorting algorithm takes O(nlog(n)) comparisons, where n is the number of data items to be sorted. Although normally we do not count the number of steps for solving a geometric problem because it is not always possible (e.g., how many step are required to solve a non-linear equation using Newton's method?), understanding the complexity of a geometric problem would be very helpful.

Adrian Bowyer and John Woodwark distinguish three types of complexity in a geometric problem: namely, dimensional complexity, analytic complexity and combinatorial complexity.

Dimensional Complexity

Geometric objects in a plane are definitely simpler than those in space, because as dimension increases the complexity of a geometric object increases. Moreover, some geometric properties available in space may not exist in a plane. A line in the xy plane has a simple equation like Ax+By+K=0; but, you have no way to write a line equation by adding a new variable z like Ax+By+Cz+K=0 because it is a plane rather than a line. Situation in higher dimensions is worse. For example, a curve in a plane does not twist; but, it can be in three dimensions. Thus, to describe the geometric properties of a curve, one has to include this "twisting" into consideration. There is no "surfaces" in a plane; but, surfaces in space are more complex than curves in space and curves in a plane.

Analytic Complexity

While it is not accurate, you may think "analytic" as "equational." Are there any complexity related to equations? A lot. Polynomials of degree 1, 2, 3, 4 and 5 are usually referred to as linear, quadratic, cubic, quartic and quintic polynomials. Then, we have rational polynomials which are the quotients of two polynomials. The following are some examples:

Beyond polynomials and rational polynomials, we have transcendental functions such as sin(), cos(), tan(), asin(), asin(), atan(), log() and exp(). All of these functions add extra complexity into the solution of a geometric problem.

Worse, in many cases an equation does not tell us the actual geometric intent at all. For example, x2 - y2 -2y -1 = 0 is a quadratic equation because the highest degree is 2. But, it is not a conic curve (i.e., an ellipse, hyperbola or parabola); it actually represents two lines, x + y + 1 = 0 and x - y - 1 = 0, because it can be factorized as (x + y + 1)(x - y - 1) = 0. An equation may not represent any point (well, any REAL point) in a plane. For example, what is the graph of x2 + y2 + 1 = 0? Since the square of any real number must be positive, the left-hand side (i.e., x2+y2+1) is always positive and hence there exists no real points that can satisfy this equation.

In some geometric operations such as intersection computation the situation can become very nasty. Detecting if a line and a surface intersect is a common operation in raytracing. However, this is definitely not an easy job, and if the surface is a complex one this job could become much more difficult. Why? In three-dimension, a line can be written as

x = a + t u
y = b + t v
z = c + t w

where t is a parameter. Plugging (x,y,z) into the equation of a surface, say f(x,y,z)=0, yields f(a+tu,b+tv,c+tw)=0. Rearranging gives us a polynomial in t:

Solving for t gives the intersection points. Mathematically it is done. Since it is well-known (in mathematics) that polynomials with degree higher than four do not have closed-form solutions. That means, numerical methods is required to solve the above equation. We have two problems here:

  1. A polynomial of degree n has exactly n roots. Numerical methods for solving equations usually deliver only one root. What if that one is not what we want?
  2. Since computers cannot represent real numbers precisely, the computed root usually are not precise either. Generally it is not a big problem. The problem usually occurs when the line is almost tangent to the surface. If the distance between the line and the surface is smaller than the computation error, you might think the line actually intersects the surface!
All of these make analytic complexity very difficult to deal with. In fact, there are other mathematical constraints that have not yet been touched upon. Therefore, that is why we use approximations to bring the study of geometric objects and their accompanying operations to a more manageable form.

Combinatorial Complexity

This is what you are familiar with. For example, searching a sorted array of n elements uses O(log2n) comparisons. The number of steps used to solve a geometric problem is a function of the number of geometric objects involved. This is similar to what you have learned in algorithms design. Since many applications use computational geometry types algorithms (e.g., computing the convex hull of a set of points), this type of combinatorial complexity measure makes sense.

If polynomials are the major tools for solving geometric problems, the number of coefficients of a polynomial, which depends on the degree of the polynomial and the number of dimensions, adds another level of complexity. For an example, a polynomial of two variables, which described a curve in the xy-plane, has (n+1)(n+2)/2 coefficients. More precisely, a line is a degree 1 polynomial and has three coefficients (e.g., Ax+By+C=0); a conic curve is a degree two curve and has six coefficients (e.g., Ax2+Bxy+Cy2+Ex+Ey+F=0); and a cubic curve is a degree three polynomial and has 10 coefficients (e.g., Ax3+Bx2y+Cxy2 +Dy3+Ex2+Fxy+Gy2+Hx+Iy+J=0). Therefore, the number of coefficients (or terms) of degree n polynomial increases proportional to the square of n.

For polynomials of three variables, which describe surfaces in space, the number of coefficients (or terms) is (n+1)(n+2)(n+3)/6, where n is the degree of the polynomial. For example, a plane is a degree 1 polynomial and has four coefficients (e.g., Ax+By+Cz+D=0); and a quadric surface is a degree two polynomial and has ten coefficients (e.g., Ax2+By2+Cz2+Dxy+Exz+Fyz+Gx+Hy+Iz+J=0). Thus, the number of coefficients of a degree n polynomial increases proportional to the cubic of n. Based on this counting, a degree 3, 4 and 5 polynomial has 20, 35 and 56 coefficients. This rate of increase forces us to only use lower degree polynomials.

However, geometric problem could have yet another combinatorial complexity which is usually due to the number of different cases. For example, when developing a curve/surface system, one needs some functions for computing the intersection of the following cases: line and line, line and circle, circle and circle. If ellipses are supported by the system, one must consider the cases of line/ellipse, circle/ellipse and ellipse/ellipse. In general, if a system supports k different types of curves, one may need k(k-1)/2 functions, one for each possible combination. The story does not end here, because a system may have other type of objects (polyhedra and surfaces). Ok, you might want to say: let us develop a general algorithm that can compute the intersection points of any two types of curves. It is certainly doable and actually there have been many papers on this subject. The problem is that general algorithms usually are not reliable enough when used to solve special cases, cases that occur frequently in practice.