Lab- lets get twisted we will draw bezier curves in this


LAB- LET'S GET TWISTED

We will draw Bezier curves in this assignment, and some objects along them. You can add control points by left-clicking on the mouse. The points will be added to a list called "ptList[MAXPTNO]" and the variable "nPt" will record the number of points. Here are the tasks that you are supposed to do:

1. In your skeleton program, when you click a new point on the screen, it will be displayed as a black point. Your first task is to draw the control lines (green ones) by joining them. This control lines are being toggled by pressing the key "L" and by the variable "displayControlLines".

2. By pressing the key "E", you should erase all control points and start as new.

3. For every four points, draw a Bezier curve. So, the first 4 points, namely the 1st, 2nd, 3rd, and 4th points of your input, will form the first curve. Then the next curve is continuously formed by the 4th to 7th points (note that the 4th point is shared by two curves, so are the 7th, 10th,... etc). The second curve is NOT formed by the 5th to 8th points instead. The number of line segments to approximate the curve is in the variable NLINESEGMENT. You are NOT recommended to use the divide-and- conquer paradigm (De Casteljau Algorithm) in this assignment. This will just make things harder for you.

4. By pressing the key "C" (Toggle the variable "C1Continuity"), you will modify the SECOND point of all curves (except the first one) and make them C1 Continuous. The new second control point will be displayed in red, and the original second control point will be dimed as grey. And this function should be reversible. And all the functions in this assignment should be working in BOTH modes of being C1 Continuous and not C1 Continuous.

5. Draw the tangent vectors by pressing the key "T" (Toggle the variable "displayTangentVectors"). The number of tangent vectors you need to draw is in the variable NOBJECTONCURVE. There is already a function drawRightArrow() to draw an arrow for you.

6. At the same manner of the tangent vectors, draw copies of an object of your own creation along the curve (Toggled by "O" and the variable "displayObjects"). You can use your Assignment 1 if you want. The objects should be drawn on the reference frame with the tangent and the normal vectors on the curve. In the sample program, the object is simply ONE circle with two lines on the north and south poles of the circle. By repeating it on the curve, it looks like a worm.

7. Create one beautiful figure and submit "savefile.txt" together with your main.cpp. (There are two functions "R" and "W" provided for you to read and write your current control points into a file called "savefile.txt".)

Submit the zipped file of your whole directory, together with your "savefile.txt" for your drawing. However, please clean and delete any files unnecessary, e.g. the whole "Release" and "Debug" directories, and the "lab 4.ncb" file. The zip file should not be larger than 5 Mb. Also, submit a "readme.txt" if you have any extra features that are impressive or any explanation of your program.

Final note: All the reshape, resize functions should be already handled. Unless you messed them up, you should not need to take care of them. You can also assume all the points input are within the 600 x 600 windows of the screen. Last but not the least; this is a new assignment for this year. There may be some amendments or modifications, please follow tightly with the forum.

1874_img.png

Attachment:- Assignment.rar

Request for Solution File

Ask an Expert for Answer!!
Computer Graphics: Lab- lets get twisted we will draw bezier curves in this
Reference No:- TGS01207736

Expected delivery within 24 Hours