drawing 2 separate paths for fireworks using Bezier curves

11 views
Skip to first unread message

elena

unread,
Nov 13, 2010, 3:31:53 PM11/13/10
to webkit-meta
Part 1: Drawing interactive curved paths.
1. Drawing Bezier curves
The first functionality is being able to draw Bezier curves which will
determine the path of an interactive object (yellow dot). The curve
drawing has to use explicit curve evaluation as discussed in class.
You may NOT use the OpenGL evaluators.

2. Implementing interactive functionality: Picking & Dragging
The second functionality to implement is allowing the user to pick
points in the screen, such as control point locations and objects.
Also, you will need to interpret user gestures such as a pressed mouse
button, followed by a drag, and a released button.
3. User Interface State
Third, in order to process events in the right context, you will need
to maintain a state in your program. For example, a user click in a
particular state can mean “place control point here” vs “pick this
object”.

Details:
When the application starts, you should display a yellow dot close to
the bottom edge of the window. The subsequent actions by the user will
drive your application. The first thing the user can do is define
curves by selecting control points. The first diagram shows how the
initial curves should look, and the control points for the curves. The
yellow dot is a shared control point between the two curves. The green
control points are for the left curve and the red control points are
for the right curve. Note, you don’t have to have curves that look
exactly like I’ve drawn, but they should be something similar. If
either of the curves is defined, the user should be able to pick any
of the control points and move them around. When the control points
are moved, the curve should change accordingly.

The second diagram shows that the yellow dot can be moved by the user,
but it is constrained to follow the curve. So you have to decide which
curve is closest to the user’s mouse movements, and follow that one
up. When the yellow dot has been picked and is being moved, the
control points are hidden.
The third diagram shows that when the yellow dot reaches the top, you
should display something resembling fireworks. You can be creative
here and draw whatever you want at the top. The fireworks stay
displayed at the top of the curve until the user changes that
particular curve. If the user moves the yellow dot over the second
curve, the same behavior is repeated.

Steps for Part 1:
1. Initialize the window and draw the yellow dot.

2. Create a menu with the following options:
a. Draw curve 1: when this is selected, the next three user picks
determine the control points for curve 1. If the user selects this
when a curve 1 already exists, the new curve replaces the old one.
b. Draw curve 2: when this is selected, the next three user picks
determine the control points for curve 2. If the user selects this
when a curve 2 already exists, the new curve replaces the old one.
c. Exit: exit your application when this is selected

3. Implement a picking callback function which
a. Detects that the user should now pick control points (either for
curve 1 or curve 2) and registers the position of the control points
b. Otherwise, after both curves are defined, it should detect when the
yellow dot is picked. That will signal that the user is ready to move
the yellow dot up one of the curves.
c. Detects if any of the control points is picked.

4. Implement a mouse motion callback which
a. Detects when the yellow dot can be moved
b. When the yellow dot is first picked, the next direction that the
mouse moves, determines which curve the dot will move along (either
curve 1 or curve 2)
c. After that, all subsequent motions of the mouse advance the yellow
dot until it reaches the top. The yellow dot returns to its original
position (at the bottom) when the mouse button is released.
d. If one of the control points is picked, the subsequent mouse
movements translate the control point to the new location. When the
mouse button is released the control point stays in the last moved
position.

5. Implement a drawing function that takes as input 4 control points
and draws a smooth Bezier curve corresponding to the control points.

6. Implement a drawing function to draw some primitive resembling
fireworks at the top of either (or both) curve(s).

7. Implement the viewport and gluOrtho2D transformations such that
when the window is resized, all primitives are scaled proportionately.

Ivan Vučica

unread,
Nov 15, 2010, 11:29:10 AM11/15/10
to webki...@googlegroups.com
Why don't you just link to:
http://cseweb.ucsd.edu/classes/wi03/cse167/assignments/assign2.pdf

Besides, why would people solve your homework?


--
You received this message because you are subscribed to the Google Groups "webkit-meta" group.
To post to this group, send email to webki...@googlegroups.com.
To unsubscribe from this group, send email to webkit-meta...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/webkit-meta?hl=en.




--
Regards,

Ivan Vučica

Reply all
Reply to author
Forward
0 new messages