GEOM_HW2_S09

erectboboΛογισμικό & κατασκευή λογ/κού

14 Δεκ 2013 (πριν από 3 χρόνια και 10 μήνες)

75 εμφανίσεις

UML CS

Geometric Modeling 91.580.201

Spring, 2009





1

of
2


Homework

#
2


Assigned
:
Mon
day,
2
/
2


Due
:
Tues
day, 2/
17

at
start

of lecture





This
assignment covers

material on curves
:


Mortenson Chapter
s

2
-
5
, Farin Chapters
4,5
,8

OpenGL


1.

(
1
0

poin
ts)
Mortenson,
Chapter 5

:
This questi
on involves Equation 5.3 on p. 150 that
specifies the nonuniform (and non
-
rational) B
-
spline
basis
functions in recursive form.

a)

What is the maximum knot index as a function of
i

and
k

?

b)

For the cubic case, how many times is each
N
i,k

used when the recur
sion of
Equation 5.3 executed to calculate ?


c)

If your goal is fast execution time, is it better to use Equation 5.3 or an alternative
method

? If another method is more appropriate, summarize its key features.



2.
(
1
0

points)
Farin
,
Chapter 4
:
Problem 2 of Section 4.6 on p. 54.


3. (1
0

points)
Farin
,
Chapter 5:
Problem
1

of Section
5
.
9 on p. 78
.


4. (10 points)
Farin
,
Chapter 8:
Problem 1 of Section 8.11 on p. 146.


5
.
(
60

points)
This part of the assignment is designed to f
amiliarize you with
the nature of the
types of parametric curves we discussed in lecture, in an OpenGL environment.

Here
we will only work in 2D. (gluOrtho2D( ) is recommended to give you an orthographic
projection.)

Your task is to implement code that du
plicates the functionality of what Prof.
Daniels demonstrated during the Feb. 2 class.
(
Shu Ye’s 3D code for an interpolating
patch and a Bezier patch
(see web site)
can be used to build your understanding of
menu selection in OpenGL. We will use this sa
me code
later on
as a basis from which
to
implement our surface assignment in Homework # 3.) Your code should have the
following 2D functionality for a
cubic

parametric curve:

a)

Upon initialization, 4 control points
p
0
,
p
1
,
p
2
,
p
3

(and their connected polyl
ine) will be
drawn in a window. These will be redrawn whenever the display is updated.

b)


A right mouse click should offer the user the following menu options:

1.

Control polyline
: Draw the control points and their polyline.

UML CS

Geometric Modeling 91.580.201

Spring, 2009





2

of
2

2.

Interpolating cubic: Draw a cubic c
urve that interpolates all 4 control points. Use
the basis functions from the lecture slide.

3.

Hermite cubic: Draw a Hermite cubic curve with the following characteristics

i.

Starting point is the first control point

p
0
.

ii.

Ending point is the fourth control point

p
3
.

iii.

Starting tangent is in the direction of
p
1

-

p
0
.

iv.

Starting tangent is in the direction of
p
3

-

p
2
.

v.

Select magnitudes for the tangents that causes the curve to exit the
convex hull of the control points.

4.

Bezier cubic (Bernstein): Evaluate the Bernstein
polynomials to generate the
curve segment that begins at control point
p
0

and ends at control point
p
3
.

5.

Bezier cubic (OpenGL): Draw the same curve segment as in (4)

above
, but use
an OpenGL evaluator instead of Bernstein polynomials.

6.

B
-
Spline cubic (unifor
m, non
-
rational): Draw
a uniform cubic B
-
spline curve using
Mortenson Equation 5.15, p.160.

7.

B
-
Spline cubic (NURBS): Draw the same curve as in (6) above, but use the
OpenGL NURBS functionality.

8.

Exit.

Note
: While there exist matrices that allow direct tran
sformation between some of the
various curve types, please do not use them for the implementation of this coding
assignment.

c)

Please submit a paper copy of the code,
and explain in what way (if any) you have used
Shu Ye’s sample

code. Also, please email yo
ur source file to Prof. Daniels.

d)

Extra Credit
: Add interaction to your program so that control points can be moved and
the selected curve will adjust accordingly.