Modelling Three-Dimensional Objects (Introduction to Computer Graphics Using Java 2D and 3D) Part 4

Efficient Computation of Polynomials

In order to draw a parametric curve, polynomials have to be evaluated. The same applies to freeform surfaces. In most cases, polynomials of degree 3 are used. This section presents an efficient scheme for evaluating polynomials, which is based on similar principles of incremental computations as introduced in the context of the midpoint algorithm in Sect. 3.2. Although floating point arithmetic cannot be avoided for polynomials in this way, it is at least possible to reduce the repeated calculations to additions only.

For drawing a cubic curve, the parametric curve is evaluated at equidistant values of the parameter t. The corresponding points are computed and connected by line segments. The same applies to freeform surfaces, which are also modelled by parametric curves or surfaces in the form of polynomials. For evaluating a polynomial f(t) at the points t0, t1 = t0 + δ, t2 = t0 + 2δ, … with a step width of δ > 0, a scheme of forward differences is applied. The polynomial has to be evaluated once for the initial value f0 = f(t0) at the point t0 and then the changes

tmpc009-325_thumb[2][2][2]


are added in an incremental fashion as

tmpc009-326_thumb[2][2][2]

or

tmpc009-327_thumb[2][2][2]

For a polynomialtmpc009-328_thumb[2][2][2]of degree 3, this leads to

tmpc009-330_thumb[2][2][2]

In this way, the evaluation of polynomials of degree 3 can be reduced to an addition of ^-values. The computation of these ^-values requires evaluations of polynomials of degree 2. These polynomials are also not explicitly evaluated. The same scheme of forward differences is also applied to them:

tmpc009-331_thumb[2][2][2]

The ^-values of the original polynomial of degree 3 are calculated from the equation

tmpc009-332_thumb[2][2][2]

A multiplication is still necessary for the computation of the ^2-values. Applying the scheme of forward differences once again, one obtains

tmpc009-333_thumb[2][2][2]

With this final step, multiplications are only required for the computation of the initial value at t0 = 0. We have

tmpc009-334_thumb[2][2][2]

For the calculation of all further values, only additions are needed. Table 6.1 illustrates this principle of difference schemes. Table 6.2 shows the calculations of the forward differences for an example, the polynomial f(t) = t3 + 2t + 3, i.e., a = 1, b = 0, c = 2, d = 3, with a step width of δ = 1.

Table 6.1 Forward difference for a general polynomial of degree 3

t0 = 0

tQ + δ

t0 + 2δ

t0 + 3δ …

tmpc009-335 tmpc009-336

+

tmpc009-337

+

tmpc009-338

+ …

tmpc009-339 tmpc009-340

+

tmpc009-341

+

tmpc009-342

+ …

tmpc009-343 tmpc009-344

+

tmpc009-345

+

tmpc009-346

+ …

tmpc009-347 tmpc009-348 tmpc009-349 tmpc009-350 tmpc009-351 tmpc009-352 tmpc009-353

Table 6.2 Forward differences for the polynomial f(t) = t3 + 2t + 3 with step width δ = 1

t = 0

t=1

t = 2

t=3

t =4 …

3

tmpc009-354

6

tmpc009-355

15

tmpc009-356

36

tmpc009-357

75 …

3

tmpc009-358

9

tmpc009-359

21

tmpc009-360

39

tmpc009-361

63 …

6

tmpc009-362

12

tmpc009-363

18

tmpc009-364

24

tmpc009-365

30 …

6

tmpc009-366

6

tmpc009-367

6

tmpc009-368

6

tmpc009-369

6 …

tmpc009-370 tmpc009-371 tmpc009-372 tmpc009-373

Freeform Surfaces

As mentioned in Sect. 6.8, freeform surfaces are closely related to parametric curves. Freeform surfaces have two parameters to describe the two-dimensional surface, whereas only one parameter t is needed for curves. When one parameter of a freeform surface is considered as fixed, then the variation of the other parameter yields a curve on the surface as can be seen in Fig. 6.21.

Bézier surfaces are composed of Bézier curves with parameters s and t:

tmpc009-374_thumb[2][2][2]

Most common are Bézier curves of degree 3. This means m = n = 3. For the definition of a Bézier surface (m + 1) · (n + 1) Bézier points bi;-, i.e., 16 in the case of cubic Bézier surfaces, have to be specified. Figure 6.22 illustrates how a net of Bézier points determines the Bézier surface.

Bézier surfaces have similar nice properties as Bézier curves. The four points at the corners b00, b0m, bn0, bnm lie on the surface. This does not apply to the other control points in general. The surface stays within the convex hull of the control point. Curves with a constant value s = s0 are Bézier curves with respect to the points

tmpc009-375_thumb[2][2][2]

and analogously for curves with constant parameter t = t0.

Fig. 6.21 A parametric freeform surface

A parametric freeform surface

Fig. 6.22 A net of Bézier points for the definition of a Bézier surface

A net of Bézier points for the definition of a Bézier surface

Since tesselations, as they are required in computer graphics, approximate surfaces with triangles and not with rectangles, Bézier surfaces of degree n, usually n = 3, are sometimes defined over a grid of triangles in the following way:

tmpc009-378_thumb[2][2][2]

The corresponding Bernstein polynomials are given by

tmpc009-379_thumb[2][2][2]

where t1 +12 +13 = 1, t1,t2,t3 > 0 and i + j + k = n (for i, j,k e N). The triangular grid is shown in Fig. 6.23.

Fig. 6.23 A triangular grid for the definition of a Bézier surface

A triangular grid for the definition of a Bézier surface

Next post:

Previous post: