Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I'm really stuck on this graphics piece of homework. I'm watching openGL in C++ videos on youtube but have had a rough time piecing it

I'm really stuck on this graphics piece of homework. I'm watching openGL in C++ videos on youtube but have had a rough time piecing it all together. Thank you some much Chegg Team!

Skeleton code provided. Everything is explained on the assignment instructions below.

image text in transcribed image text in transcribed

image text in transcribed

#ifdef-APPLE #include #include #include #else #include #include #include #endif #include vector #include using namespace std; class Vertex GLfloatx, yi public: Vertex(GLfloat, GLfloat); GLfloat get y) return yi GLfloat get x() f return xi ; Vertex::Vertex (GLfloat X, GLfloat Y) void setup) glClearColor (1.ef, 1.8f, 1.8f, 1.8f) vector generate_points (vector control_points) vector points; //TODO: // Generate return points; void draw-curve (vector control-points, int n-iter) { // TODO: // Draw a Bezier curve based on the given control points void display() f glClear(GL_COLOR_ BUFFER_BIT I GL_DEPTH_BUFFER BIT) // Set our color to black (R, G, B) // TODO: //Draw cartoon glutSwapBuffers); Assignment 1: Cartoonify Due Friday, February 15, 2019 11:59 PM PST The assignment will focus on the concept of Chaikin, Bzier curve algorithm. Given a headshot photo of an individual (e.g. the headshot of Ed Sheeran), generate the cartoon version of the photo by sketching it using Chaikin or Bzier curves. Skeleton code has been provided to guide you along the way. The places that you will be required to implement has been marked with a TODO I have provided you with a simple Vertex class that allows you to specify the x and y values ofa point. You will utilize this class for modeling the control points of your sketch. "Note: the C++ vector class is the equivalent to a list in most other languages. You maly use the push _back(object o) function of the vector class to hold your set of points. You will complete the following functions for the assignment: 1) generate_points: a function that generates takes in a set of control points for your Chaikin or Bzier curve algorithm and returns the new set of control points parameters: vector vector 2) draw_curve : calls generate_points to generate the control points using the Chaikin or Bzier curve algorithm and forms a curve by connecting the points with lines parameters: vector, int returns none The parameter n_iter refers to the number of iterations to run the Chaikin or Bzier algorithm. Recall that each time the algorithm is ran, you will obtain a set of new points. You will submit the following to Bright Space 1) "assignment1.cpp" 2) Your sketch in JPEG, JPG, or PNG: results.peg, jpg, pngh 3) The photo your sketch was based on in JPEG, JPG or PNG: photo.ipeg, jpg, pngh Grading: I will be compiling the assignment using the following command: gcc -o assignment1 assignment1.cpp -std-c++14 -1GL -LGLU -lglut #ifdef-APPLE #include #include #include #else #include #include #include #endif #include vector #include using namespace std; class Vertex GLfloatx, yi public: Vertex(GLfloat, GLfloat); GLfloat get y) return yi GLfloat get x() f return xi ; Vertex::Vertex (GLfloat X, GLfloat Y) void setup) glClearColor (1.ef, 1.8f, 1.8f, 1.8f) vector generate_points (vector control_points) vector points; //TODO: // Generate return points; void draw-curve (vector control-points, int n-iter) { // TODO: // Draw a Bezier curve based on the given control points void display() f glClear(GL_COLOR_ BUFFER_BIT I GL_DEPTH_BUFFER BIT) // Set our color to black (R, G, B) // TODO: //Draw cartoon glutSwapBuffers); Assignment 1: Cartoonify Due Friday, February 15, 2019 11:59 PM PST The assignment will focus on the concept of Chaikin, Bzier curve algorithm. Given a headshot photo of an individual (e.g. the headshot of Ed Sheeran), generate the cartoon version of the photo by sketching it using Chaikin or Bzier curves. Skeleton code has been provided to guide you along the way. The places that you will be required to implement has been marked with a TODO I have provided you with a simple Vertex class that allows you to specify the x and y values ofa point. You will utilize this class for modeling the control points of your sketch. "Note: the C++ vector class is the equivalent to a list in most other languages. You maly use the push _back(object o) function of the vector class to hold your set of points. You will complete the following functions for the assignment: 1) generate_points: a function that generates takes in a set of control points for your Chaikin or Bzier curve algorithm and returns the new set of control points parameters: vector vector 2) draw_curve : calls generate_points to generate the control points using the Chaikin or Bzier curve algorithm and forms a curve by connecting the points with lines parameters: vector, int returns none The parameter n_iter refers to the number of iterations to run the Chaikin or Bzier algorithm. Recall that each time the algorithm is ran, you will obtain a set of new points. You will submit the following to Bright Space 1) "assignment1.cpp" 2) Your sketch in JPEG, JPG, or PNG: results.peg, jpg, pngh 3) The photo your sketch was based on in JPEG, JPG or PNG: photo.ipeg, jpg, pngh Grading: I will be compiling the assignment using the following command: gcc -o assignment1 assignment1.cpp -std-c++14 -1GL -LGLU -lglut

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

A Complete Guide To Data Science Essentials

Authors: Miguel

1st Edition

9358684992, 978-9358684995

More Books

Students also viewed these Databases questions

Question

b. Explain how you initially felt about the communication.

Answered: 1 week ago