CAD: Curves and Surfaces: Part I of III
CAD: Curves and Surfaces: Part I of III
We saw earlier how CSG or BREP can be used as schemes to represent solids in a
computer. Using either a CSG or a BREP model, one can, potentially answer any
question about the solid that is represented. Some of these questions could be:
There are many other questions that arise when performing analysis of solids, depending
upon the application, some of which we shall see later on.
Problem: In CSG, the solid is built using a set of primitives. There may be some shapes
that can not be built using any combination of a given set of primitives. An example of
this is shapes that are known as sculptured (or free-form) shapes. Free-form shapes, as far
as we are concerned, represents shapes that are not linear/planar, or based on conic
sections.
Many objects in life have shapes that can not be described by operations on simple
primitives. This means that more complex mathematical representations are needed to
describe such shapes. When a CSG representation is built, the user specifies the values of
the parameters for the primitives. For instance, changing the length, width or height of a
block; changing the diameter or height of a cylinder etc. In all these operations, the basic
shape of the primitive remains the same, in some sense.. for instance, a block is scaled
differently along the X-Y-Z axes, but it is still a rectangular parallelepiped.
However, in case of sculptured surfaces, each object we study has a different basic shape.
How then can we specify a primitive shape for it in a CSG system ?
This problem was studied in depth in the early days of CAD due to its importance to the
automobile (and later, aircraft) industry. Basically, we still need a "nice" mathematical
representation of a surface in order to use it in a computerized system. In terms of "nice",
one of the best behaved set of functions (and also most studied) are polynomials. (Why ?)
A point in 3-D Euclidean space can be represented by the linear sum of its coordinates
along three mutually independent vectors (called the basis). The most common basis is
three mutually orthogonal unit vectors denoted (i, j, k).
The norm of P, denoted |P|, is the Euclidean distance of P from the origin;
P • Q = pxqx + pyqy + pzqz = |P| |Q| cosθ; θ is the angle between P and Q.
i j k
PxQ = px py pz
qx qy qz
= |P| |Q| sinθ u; where u is a unit vector perpendicular to P and Q, and
oriented by the right-hand rule, measuring θ from P to Q.
• an implicit curve;
• an explicit (or non-parametric) curve;
• a parametric curve;
P( x, y)
R
θ
x
O
This is called the implicit equation of the circle, since the value of x is not directly
represented as a function of y (or vice versa). The general form of an implicit equation is:
g( x, y, z) = 0.
y = (R2 – x2)1/2
The above is a parametric equation of the circle, and is said to be in rational polynomial
form, since each equation is a ratio of polynomial functions of the parameter t.
The best way to represent space curves (or surfaces) for use in computational geometry
are parametric forms, using equations of the form:
x = x(t), y = y(t), z = z(t).
Or, if we represent the curve as the locus of the position vector R, the parametric equation
is:
r(t) = ( x(t), y(t), z(t)).
Remember that a curve may be planar, or 3-Dimensional. For example, what does the
following curve represent:
Arc Length:
We have seen that one parameter, t, varies in its value over real interval [a,b], with r(a)
being the starting point of the curve, and r(b) the end point. It is therefore possible to
describe a curve by a parameter, s, in the range [0, L] where L is the length of the curve,
and the parameter value at any point equals the length of the curve from the start point to
r(s). For most curves, it is not easy (or convenient to find such a parametric form). We
will distinguish the arc-length parameter (s) from all other types of parameters (t) that we
shall use.
For curve r(s), arc length between points r(a) and r(b) = | b – a |.
For a curve r(t), the arc length between two points corresponding to t = a and t = b is
given by:
b
s=∫ r . r dt where r = dr / dt
a
If we express the arc length from t = a to an arbitrary point, t, then we get the following
important form:
t
arc length = s (t ) = ∫ r . r dt
a
Tangent:
s δs
P δr
Q
r(t)
r(t + δt)
A curve, r(t) is shown in the figure above. As δt Æ 0, the vector dr/dt will become
parallel to the tangent. Thus the unit tangent vector, T = (dr/dt) / | dr/dt |. In particular,
since s is the arc length, as ds Æ 0, the chord δr will approach the length of the arc, δs,
and | dr/ds | Æ 1. Thus, if the curve is represented in terms of the arc length as r(s), the
unit tangent vector is given by dr/ds.
T = r’ = dr / ds.
The figure above shows a general 3D curve. Notice that the curve is characterized at any
point by two things: how much it is curving, and how much it is twisting. For such 3D
curves, the plane perpendicular to T is a normal plane, and any vector in the normal plane
is a normal vector. The vector dT/dt lies in the Normal plane (since it is perpendicular to
T) The unit vector parallel to dT/dt is called the principal normal, N. In particular, if r =
r(s), then |dT/ds | indicates the magnitude by which the tangent vector is “curving” – in
other words:
dT/ds = κN
Where κ is the curvature of the curve, and the radius of curvature of the curve is defined:
ρ = 1 / κ.
| r x r |
It can be shown that curvature = κ ( s ) = | u ’( s ) | = | r" ( s ) | =
| r |3
All physical objects are bound by surfaces. Surfaces can be described mathematically in
implicit, explicit (non-parametric) or parametric form. These representations are
extensions of definitions of curves.
Implicit forms:
2 2 2 2
(x - rx) + (y - ry) + (z - rz) - R = 0.
Non-parametric forms:
Rearranging the sphere equation from above, we get the corresponding explicit form:
Parametric forms:
The parametric representation of a curve was a set of functions, x(t), y(t) and z(t), in terms
of one parameter, t.
Surfaces are represented similarly, using two parameters, u and v. Any position vector on
the surface, r(u, v), is represented:
For instance, a unit sphere, centered on the origin, can be represented in terms of
parameters u and v as:
r( u, v) = ( cos v cos u, cos v sin u, sin v), with 0 u π, 0 v π/2.
Tangent plane r( u, 1)
rv . v
r(t)
ru
r(t) c( t)
r( 1, v)
r( 0, v) r( u, v)
u
v r( u, 0) u-v domain
u
For a surface defined by r( u, v), consider a curve, c( t), lying on the surface. Thus, c( t) =
( u( t), v( t)). Since c( t) lies on the surface r( u, v), therefore c(t) forms a curve, r( t), on
the surface.
dr ∂r du ∂r dv
r = = + = ru u + rv v
dt ∂u dt ∂v dt
Where dr/dt is the tangent vector of the curve r(t); ru and rv lie in the tangent plane, and
are the tangents to isoparametric curves (curves with one of the parameters, u or v,
remaining constant). The normal vector lies along the cross product of ru and rv.
The normal vector is extremely important in machining, since it is used in computing the
offset surface for r( u, v). For instance, an offset surface with offset d, is given by:
r° ( u, v) = r ( u, v) + d n ( u, v).
Remember from your engineering maths that the gradient of an implicit equation of a
surface defines the normal to the surface f( x, y, z) = 0:
∂f ∂f ∂f
grad f = j!+! k!+! l
∂x ∂y ∂z
The gradient has an important property that it is invariant with respect to the coordinate
frame. It also has the property that it lies along the normal to the surface. This can be
proved as follows. Consider a scalar representation of a surface, f( x , y, z) = 0, and a
curve, r( t) = x(t) i + y(t) j + z(t) k, that lies on this surface. Since all points on this curve
must satisfy the equation of the surface, we have: f( x(t), y(t), z(t)) = 0. differentiating
with respect to the curve paramater t, and using the chain rule, we get:
∂f ∂f ∂f
x!+! y !+! z = ( grad f ) . r = 0
∂x ∂y ∂z
This indicates that (grad f) is perpendicular to the direction of the tangent – that is, it lies
along the normal to the surface. This is an easy way to compute the normal of surfaces
described by an implicit equation. However, most of the time, we will deal with surfaces
that are defined in a parametric form.
Another property of a surface we often need to compute is its curvature. For example, if
we need to machine a surface, and our tool, say a ball-end mill, touches the surface at
some point. If the radius of the surface (along any direction) is less than the radius of the
tool, then the tool will cut into the part. This situation, called gouging, is undesirable.
Thus, if we have a surface that needs to be machined, we must first compute, for each
point on it, the radius of curvature. The minimum value for the radius (at the point on the
surface that is ‘most curved’) indicates the largest tool that can machine the entire surface
without gouging. There are two problems:
(1) The surface has an infinite number of points. This problem is handled by
discretization of the surface, and only considering a mesh of points that approximate the
surface closely.
(2) At each point, there are an infinite number of directions, and a (possibly) different
curvature along each direction. Fortunately, it can be shown that at each point, we can
compute the principle directions, and the curvatures along the two orthogonal principal
directions are the local extrema – one principal curvature is the minimum, and the other
the maximum. Hence, one only needs to compute the values of the principal curvatures at
each point.
Consider again, a surface r(u,v) with a curve r(t) lying on it – denoted r( u(t), v(t)). We
shall use a 2x1 matrix, u(t) = u = [u(t), v(t)] T to denote the functions of the two
parameters.
Let us look at the curve r(t) lying on our surface. Using the chain rule for differentiation,
the tangent vector of this curve is obtained as:
∂x / ∂u ∂x / ∂v
∂r ∂r
r = u + v = Au , where A = ∂y / ∂u ∂y / ∂v
∂u ∂v
∂z / ∂u ∂z / ∂v
The length of the tangent is calculated from:
∂r ∂r ∂r ∂r
∂u ⋅ ∂u ⋅
∂u ∂v
| r | 2 = r T r = u T AT Au we denote AT A = G =
∂r ⋅ ∂r ∂r ∂r
⋅
∂v ∂u ∂v ∂v
G is called the first fundamental matrix of the surface, and the unit tangent vector along
the curve u(t) on the surface is given by:
r Au
T= = T
| r | (u Gu )1 / 2
For a general curve, u(t) lying on a surface, using the definitions in the previous section
and the chain rule, we see that:
du du ds d ( sT ) dT dT ds dT
= = sT ; and r = = sT + s = sT + s = sT + s 2 = sT + s 2κN
dt ds dt dt dt ds dt ds
And using the equation for tangent derived earlier, and the chain rule, we get the
following:
dr ∂r d (∂r / ∂u ) ∂r d (∂r / ∂v) ∂ 2r 2 ∂ 2r ∂ 2 r 2 ∂r ∂r
= u + u + v + v = u
+ 2 u
v
+ v + u + v
dt ∂u dt ∂v dt ∂u 2
∂u∂v ∂v 2
∂u ∂v
From the above two expressions, taking the dot product with a unit vector, n, normal to
the surface, we get the expression for the curvature (note: n is perpendicular to T and to
the partial derivatives of r with respect to u and v):
∂ 2r ∂ 2r ∂ 2r
s 2κN ⋅ n = n ⋅ 2 u 2 + 2n ⋅ uv + n ⋅ 2 v 2
∂u ∂u∂v ∂v
Using the matrix notation, we can write this as:
∂2r ∂2r
n ⋅ n ⋅
∂u 2 ∂u∂v
s 2κN ⋅ n = u T Du , where D =
∂ 2r ∂2r
n ⋅ ∂u∂v n ⋅ ∂v 2
D is called the second fundamental matrix of the surface. Note that N is a unit normal to
the curve (on the surface), while n is a unit normal to the surface. In general, these two
vectors may not be parallel. You can imagine this by thinking of a point P on a surface,
and imagining several curves passing through this point. The normal vectors to these
curves at P may not all be parallel. Imagine a curve such that its normal at P is parallel to
the surface normal. The curvature of the surface along this curve, at point P, is called the
normal curvature and denoted κn. In this case, since N.n = 1, we get:
u T Du u T Du
κn = = T
s 2 u Gu
.
normal plane through P, r
curve: u = u(t)
n
P . .
r = Au
surface: r(u, v)
As we rotate the normal plane in the above figure through the point P, the value of κn
changes. The minimum and maximum values of the curvature can therefore be derived by
differentiating the expression of κn with respect to the tangent direction [du/dt, dv/dt].
These directions are called the principal directions, and the corresponding values of
curvature are called the principal curvatures. The values of the principle curvatures are
given by the following expression:
We need surfaces for representing the geometry of useful parts. These surfaces are
complex by nature. What must we be able to do with our surface equations ?
(a) We must be able to generate the Cartesian coordinates of the points on the surface.
(b) We must be able to generate the equations of tangent planes, and normal vectors at
any point on the surface
(c) We must be able to find the curvature (if it is defined) at any point on the surface.
(d) We must be able to approximate the surface by a grid of small (planar) patches. In
particular, we must be able to approximate the entire surface by a set of small, well-
behaved triangles. Likewise, we must be able to convert a solid contained by one or more
surfaces by a set of small, well-behaved tetrahedrons.
Normals and curvatures have practical applications in generating the machining plans for
surfaces. Triangulation of surfaces is useful in creating a planar representation called
STL, which is commonly used for layered manufacturing. Tetrahedral tessellation is
useful for finite element analysis.
In the next section, we study the following problem: among the different methods of
representing curves and surfaces (implicit, explicit, parametric), which format is best for
what we need to do ?