/docs/MyDocs

To get this branch, use:
bzr branch http://darksoft.org/webbzr/docs/MyDocs

« back to all changes in this revision

Viewing changes to Development/libraries/opengl/nurbs/NURBS.html

  • Committer: Suren A. Chilingaryan
  • Date: 2009-04-09 03:21:08 UTC
  • Revision ID: csa@dside.dyndns.org-20090409032108-w4edamdh4adrgdu3
import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 
2
<html>
 
3
<head>
 
4
  <meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
 
5
  <title>NURBS</title>
 
6
</head>
 
7
<body>
 
8
<h3>Bézier curves</h3>
 
9
<p style="text-align: justify;">The following figure shows a
 
10
simple <strong>Bézier curve</strong> (C),
 
11
its <strong>control points</strong> (1), (2), (3), (4), and its <strong>control
 
12
polygon</strong> (P). The control points are
 
13
also called control handles.</p>
 
14
<p align="center"> <img
 
15
 src="nrbs-controlpolygon.png"
 
16
 alt="Control polygon and control points of a Bézier curve." border="0"
 
17
 height="200" width="300"><br>
 
18
<small>A cubic Bézier arc (C) with its control polygon (P).</small></p>
 
19
<p style="text-align: justify;">Each point on a Bézier curve (and on
 
20
many other kinds of curves) is computed as a weighted sum of all
 
21
control points.
 
22
This means that each point is influenced by every control point. The
 
23
first
 
24
control point has maximum impact on the beginning of the curve, the
 
25
second one reaches its maximum
 
26
in the first half of the curve, etc. Each control point influences the
 
27
final curve according to assigned <strong>blending function</strong>.
 
28
A blending function defines the weight of the control point at each
 
29
point of the curve. A value of 0 indicates that the control point
 
30
is not affecting a point on the curve. If the blending function reaches
 
31
1, the curve is (usually) intersecting the control point. <br>
 
32
</p>
 
33
<p align="center"> <img
 
34
 src="nrbs-blendingfunctions.png"
 
35
 alt="Blending functions of a cubic Bézier curve." border="0"
 
36
 height="200" width="300"><br>
 
37
<small>Blending functions of a cubic Bézier curve.<br>
 
38
Four functions for four control points - each in different shade of red.</small></p>
 
39
<p><br>
 
40
</p>
 
41
<div style="text-align: justify;">So, the Bézier curves are defined by
 
42
the number and positions of control points (<a
 
43
 href="http://en.wikipedia.org/wiki/Bernstein_polynomial"
 
44
 title="Bernstein polynomial">Bernstein basis polynomials</a> are
 
45
always used as blending functions, see example above). The number of
 
46
control points is called <span style="font-weight: bold;">order</span>
 
47
of Bézier curve.<br>
 
48
The following characteristics are applicable:
 
49
</div>
 
50
<ul style="text-align: justify;">
 
51
  <li>The curve starts in the first control point, ends in the last
 
52
control point, but in general case does not cross the inner control
 
53
points.</li>
 
54
  <li>The tangent of the curve in its ending points is controlled by
 
55
the inner control points.</li>
 
56
  <li>The curve is always inside the convex hull of the control polygon.</li>
 
57
  <li><a href="http://en.wikipedia.org/wiki/Bezier_curve">Mathematically</a>,
 
58
the bézier curves are polynomial functions of given degree (degree =
 
59
order - 1)<br>
 
60
  </li>
 
61
</ul>
 
62
<div style="text-align: justify;">Using curves with multiple control
 
63
points are quite expensive because
 
64
of growth of polonomial degree. Therefore, to construct complex lines
 
65
the glued together cubic (4 control points) Bezier curves are normally
 
66
used (In the connection points (<span style="font-weight: bold;">knots</span>)
 
67
the curve is continous but not differentiable.<br>
 
68
<span style="font-weight: bold;"></span><br>
 
69
<span style="font-weight: bold;">Rational curves</span> - Each control
 
70
point in rational curve is assigned a <strong>weight</strong>. The
 
71
weight
 
72
defines how much does a point "attract" the curve. Only the relative
 
73
weights of the control points are important, not their absolute values.
 
74
A curve with all weights set to 1 will have the same shape as if all
 
75
weights are set to 100. The shape only changes
 
76
if weights of control points are different.<br>
 
77
</div>
 
78
<h3>B-Splines &amp; NURBS<br>
 
79
</h3>
 
80
<p style="text-align: justify;">B-spline is generalization of Bézier
 
81
curves. Again, each point of the curve is computed by taking a&nbsp;<a
 
82
 href="http://en.wikipedia.org/wiki/Weighted" title="Weighted"
 
83
 class="mw-redirect"></a>weighted sum of a number of control points
 
84
(but not all!). The weight of any control point
 
85
is only nonzero in one interval of the parameter space. Within that
 
86
interval, the weight changes according to a polynomial function (<i>basis
 
87
functions</i>)
 
88
of a certain degree. At the boundaries of the interval the basis
 
89
functions go smoothly to zero, the smoothness being determined by the
 
90
degree of the polynomial.<br>
 
91
</p>
 
92
<p style="text-align: justify;"> The <i style="font-weight: bold;">order</i><span
 
93
 style="font-weight: bold;"> of B-Spline</span> is defined by the
 
94
number of nearby control points that influence any given point on the
 
95
curve. Unlike bezier curves, the B-splines are not polynomials.
 
96
However, at
 
97
each knot span separately they can be&nbsp; repreented as a polynomial
 
98
of
 
99
<span style="font-weight: bold;">degree</span> one less than the order
 
100
of the curve. Hence, second-order curves
 
101
(which are represented by linear
 
102
polynomials) are called linear curves, third-order curves are called
 
103
quadratic curves, and fourth-order curves are called cubic curves. In
 
104
practice, cubic curves are the ones most commonly used.</p>
 
105
<span style="font-weight: bold;"></span><span style="font-weight: bold;"></span>
 
106
<p style="text-align: justify;">The <span style="font-weight: bold;">knot
 
107
vector</span> is a sequence of parameter values that determines where
 
108
and how the control points affect the curve. The number of knots
 
109
is always equal to the number of control points plus curve order. The
 
110
knot vector divides the parametric space in the intervals
 
111
mentioned before, usually referred to as <i>knot spans</i>. Each time
 
112
the parameter value enters a new knot span, a new control point becomes
 
113
active, while an old control point is discarded.<br>
 
114
Consecutive knots can have the same value. This then defines a knot
 
115
span of zero length, which implies that two control points are
 
116
activated at the same time (and of course two control points become
 
117
deactivated). This has impact on continuity of the resulting curve or
 
118
its higher derivatives; for instance, it allows to create corners in an
 
119
otherwise smooth NURBS curve. A number of coinciding knots is sometimes
 
120
referred to as a knot with a certain <b>multiplicity</b>. Knots with
 
121
multiplicity two or three are known as double or triple knots. The
 
122
multiplicity of a knot is limited to the degree of the curve; since a
 
123
higher multiplicity would split the curve into disjoint parts and it
 
124
would leave control points unused. For first-degree splines, each knot
 
125
is
 
126
paired with a control point.<br>
 
127
The knot vector usually starts with a knot that has multiplicity equal
 
128
to the order. This makes sense, since this activates the control points
 
129
that have influence on the first knot span. Similarly, the knot vector
 
130
usually ends with a knot of that multiplicity. Curves with such knot
 
131
vectors start and end in a control point.<br>
 
132
The individual knot values are not meaningful by themselves; only the
 
133
ratios of the difference between the knot values matter. Hence, the
 
134
knot vectors (0, 0, 1, 2, 3, 3) and (0, 0, 2, 4, 6, 6) produce the same
 
135
curve (this is because the smallest knot values is always assigned to
 
136
the begining of curve and the highest to the end, other values are just
 
137
normalized). The positions of the knot values influences the mapping of
 
138
parameter space to curve space. Rendering a NURBS curve is usually done
 
139
by stepping with a fixed stride through the parameter range. By
 
140
changing the knot span lengths, more sample points can be used in
 
141
regions where the curvature is high.<br>
 
142
</p>
 
143
<p style="text-align: justify; font-style: italic;">So, B-spline is
 
144
defined by order, coordinates of control points and knot vector.<br>
 
145
</p>
 
146
Some characteristics:<br>
 
147
<ul>
 
148
  <li> A knot can be inserted into a NURBS curve without
 
149
changing the shape of the curve. </li>
 
150
</ul>
 
151
<p><span style="font-weight: bold;"><br>
 
152
NURB</span> is just Non-Uniform (knot vector is not uniform) Rational
 
153
(weighted) B-Spline<br>
 
154
<a href="http://en.wikipedia.org/wiki/Image:Surface1.jpg" class="image"
 
155
 title="Surface1.jpg"><img alt=""
 
156
 src="Surface1.jpg"
 
157
 border="0" height="276" width="422"></a><br>
 
158
</p>
 
159
</body>
 
160
</html>