Building A Polygon Mesh Surface

The solid object we wish to draw and model are bounded by various surfaces, which form the skin of the object. The object is modelled by having a skin composed of a number of planer polygons. Very complex objects can be modelled as a patchwork of pieces of different surfaces called patches. We need to calculate the set of polygons to represent a surface. Two main types of surfaces are ruled surfaces and surfaces of revolution.

Ruled surface.

A surface is ruled if through every one of its points, passes at least one line which lies entirely on its surface. Ruled surfaces are created by dragging a line segment through space and the line remains parallel with itself at all times.

Ruled Surface

e.g. A cylinder is a ruled surface, formed by dragging a line segment around a circle. To generate a cylinder we need to consider the parametric from a line (this form is also known as a ray).

\[ L(t)=P_{1}(1-t)+P_{2}t \]

This can be broken down into component rays:

\[\begin{eqnarray*} L_{x}(t)= x_{1}(1-t)+x_{2}t\\ L_{y}(t)= y_{1}(1-t)+y_{2}t\\ L_{z}(t)= z_{1}(1-t)+z_{2}t \end{eqnarray*}\]
Generating a Cylinder

To generate the cylinder we will rotate a line around the x-axis. The line will remain parallel to the axis.

A point on a line is constrained by the parameter t, its coordinates are given by:

$(P(t)=(x(t),y(t),z(t)))$

as t increases from 0 to 1, the point moves along the line. As the line is parallel to the x-axis, the y and z components remain constant, so we can re-write the above equation for this case: \[ P(t)=(x(t),r,0)\]

Consider a point on the line, as the line is rotated, the coordinates of the point must change depending on the angle of rotation. So the entire surface is governed by two parameters, $t$ and $\phi$ , $t$ determines how far along the line a point is and $\phi$ determines how far around the circle the point is.

Do we can write the equation of the surface as a parametric in two variables: \[ Q(t,\phi)=(x(t,\phi),y(t,\phi),z(t,\phi))\]

As the line is rotated, the x-coordinate of the point does not change so $x(t,\phi)=x(t)$ . We know that t has no effect on y and z, but we need to determine how $\phi$ changes y and z.

Any point $(y',z')$ on the circle is given by: $y'=r\cos(\phi), z'=r\sin(\phi)$ . Therefore the surface equation for this cylinder is: \[ Q(t,\phi)=(x(t),r \cos(\phi),r \sin(\phi))\]

We can obtain the coordinates of an arbitrary polygon on the surface at coordinates $t$ , $\phi$ on the above cylinder, by choosing the following points:

\[ Q(t,\phi), Q(t,\phi+\delta \phi), Q(t+\delta t,\phi+\delta \phi), Q(t+\delta t,\phi)\]

Suitable values of $\delta t$ and $\delta \phi$ will give appropriately sized polygons. Iterating this over the surface of the cylinder will generate all the points necessary for a polygon mesh of the cylinder.

Surfaces of Revolution

Here we rotate a curve through space and trace out an object. The Generator curve is usually given as a curve in the z-x plane and is defined parametrically: $C(t)=\{x(t),0,z(t)\}$ . Each point in the curve is rotated about the z-axis, with $\phi$ specifying the angle of rotation.

Rotation of a point around the z-axis generates a circle. Radius of the circle at any point on the curve is $x(t_{1})$ therefore the x & y co-ordinates of points on the circle are given by:

\[\begin{eqnarray*} x_{1} &=& x(t_{1})\cos(\phi)\\ y_{1} &=& x(t_{1})\sin(\phi)\\ z_{1} &=& z(t_{1})\end{eqnarray*}\]

So the general parametric equation for a surface of revolution is:

\[ P(t,\phi)=\big(x(t)\cos(\phi),x(t)\sin(\phi),z(t)\big)\]

Surface of revolution applet (http://www.nbb.cornell.edu/neurobio/land/OldStudentProjects/cs490-96to97/anson/FigureRotationApplet/)

The Sphere

A sphere can be generated by rotating a semi-circle on the x-z plane around the z-axis.

A point along the semi-circle is $\big(r\cos(t),r\sin(t)\big)$ , where $-\frac{\pi}{2}\leq t \geq \frac{\pi}{2}$ , i.e.$ x(t)=r\cos(t)$ and $z(t)=r\sin(t)$ . The semi-circle is then rotated around the z-axis by an angle of $2\pi$ , this generates a sphere. So the parametric equation for a sphere is:

\[ S(t,\phi)=(r\cos(t)\cos(\phi), r\cos(t)\sin(\phi), r\sin(t))\]

So when we are creating a set of polygons to represent the sphere, we must rotate the semi-circle by a constant angle say $\delta\phi$ . Each position of the curve as it is rotated is called a meridian. For a sphere this represents a line of longitude. Each point on the curve, traces out a circle parallel to the xy-plane, the circles are called parallels. Where a parallel meet a meridian, the vertices of a upper-right polygon can be calculated.

The Torus

The torus is a doughnut shape and is generated by sweeping a displaced circle about the z-axis.

A displaced circle is given by;

\[\begin{eqnarray*} P(t)&=&\big(R+r\cos(t),0,r\sin(t)\big) \textrm{ where: } 0\leq t \geq 2\pi\\ x(t)&=&R+r\cos(t)\\ z(t)&=&r\sin(t)\end{eqnarray*}\]

where $R$ is the Major Radius (radius swept by displaced circle), and $r$ is the minor radius (radius of generating circle). Applying the equation of rotation to the above, gives;

\[ T(t,\phi)=\big((R+r\cos(t))\cos(\phi),(R+r\cos(t))\sin(\phi),r\sin(t)\big) \]

Interactive Curve and Surface Design

Until now, our curves and surfaces have been based on relatively simple geometric and mathematical formula. These shapes could only be modified by adjusting the parameters. This technique is non-intuitive and makes it difficult to control the final shape.

We would like to develop tools which allow a designer to fashion a large variety of shapes by specifying and modifying a small collection of control points.

Bezier Curves

A simple method for creating a curve is to specify start ($P_{0}$ ) and finish($P_{2}$ ) points and one control point($P_{1}$). In order to generate a curve, intermediate points $A_{t}$ and $B_{t}$ are calculated. $A_{t}$ is generated by linearly interpolating (tweening) between $P_{0}$ and $P_{1}$ , similarly $B_{t}$ is tweened between $P_{1}$ and $P{2}$ . Finally a point on the curve ($Q_{t}$ ) is tweened between $A_{t}$ and $B_{t}$ .

\[\begin{eqnarray*} A_{t} & =&(1-t)P_{0}+tP_{1}\\ B_{t} & =&(1-t)P_{1}+tP_{2}\\ Q_{t} & =&(1-t)A_{t}+tB_{t}\\ & =&(1-t)^{2}P_{0}+2t(1-t)P_{1}+t^{2}P_{2}\\ \end{eqnarray*}\]

For four control points $ P_{0}\ldots P_{3}$ ,the curve is generated by tweening the first three points giving point $D_{t}$ and tweening the last three points giving point $E_{t}$ , the point on the curve $Q_{t}$ is then tweened between $D_{t} \& E_{t}$ .

\[\begin{eqnarray*} Q_{t} & =& (1-t)D_{t} + tE_{t}\\ & =& P_{0}(1-t)^{3}+P_{1}3(1-t)^{2}t+P_{2}3(1-t)t^{2}+P_{3}t^{3}\\ \end{eqnarray*}\]

 

In fact the coefficients of these equations follows Pascal's triangle;

Pascal's Trianlgle of Binomoial coefficients ${n \choose k}$

 

This process can be extended to any number of control points $(P_{0}\ldots P_{n})$ ;

\[ Q_{t}=\sum_{k=0}^{n}P_{k}{n \choose k}(1-t)^{n-k}t^{k} \]

where

\[ {n \choose k}=\frac{n!}{k!(n-k)!} \]

let

\[ B_{k}^{n}(t)={n \choose k}(1-t)^{L-k}t^{k} \]

$B_{k}^{L}(t)$ is known as the $k^{th}$ Bernstein Polynomial of Degree L , sometimes referred to as a blending function.

Blending Functions $B_{k}^{3}(t)$

The shape of these blending functions are shown in the figure above. These functions determine the influence of each control point on the shape of the curve. For example $B_{1}^{3}(t)$ indicates the effect of $P_{1}$ on the resulting curve. Also, the sum of the Blending functions at any give value of t is unity.

This method of constructing curves was developed by the French engineer, Bezier for use in designing car bodies. The curve is fashioned by specifying an arbitrary set of control points, observing the resulting curve, and changing the position of the control points until a satisfactory curve was produced. The path of the curve is 'attracted' to the nearest control point, although all the control points effect the shape of the curve, depending on how 'far away' the control points are. Changing one control point, while attempting to change the shape of a the curve in one area, will result in the entire curve being modified.

Properties of Bezier Curves

  1. End point interpolation: The curve always passes through $P_{0}$ and $P_{L}$ . This property is useful as it makes designing and controlling the curve easier.

  2. Convex Hull: The Bezier curve never wanders outside its convex hull. This property arises because of tweening.

  3. Variation Diminishing: Roughly speaking, a Bezier curve will never have any more "bends" than it has control points, therefore a designer can predict that a Bezier Curve will not fluctuate wildly.

Problems with Bezier Curves

  1. As the number of control points rise, the Bezier curve becomes expensive to compute. Every control point needs to be considered for each position on the curve.
  2. Bezier curves do not offer enough local control. A change to one control point changes the entire curve. This is because the each Bernstein polynomial is active over the entire range of the curve.

Bezier Surface

A Bezier surface can be generated by using 2-dimensional array of control points.

CatmulRom Spline

A CatmulRom Spline is another class of spline, in which the curve passes through the control points and the control points exibit only local influence