• Cyberian's Gold

    Re: CS602 Assignment 2 Solution and Discussion

    Assignment No. 02
    Semester: Spring 2020
    CS602: Computer Graphics
    Total Marks: 20

    Due Date: 15 June 2020

    The objective of this assignment is to;
     Learn and practice basic concepts of computer graphics like pixels, lines, text etc using Dev-C++. (You can download Dev-C++ setup from LMS)
     Learn to draw rigid bodies by using graphics library functions.
     Learn the concepts of filled area primitives.
     Learn the basic transformations with fundamental matrix operations.
    You have to do the following steps first in order to perform the task.

    1. Install Dev-C++ from your LMS.
    2. Read out the file “Add graphics in Dev cpp” thoroughly and follow the instructions in the file properly provided to you on your LMS.
      Please read the following instructions carefully before submitting assignment:
    3. You should consult the recommended books, PowerPoint slides , Handouts and video lectures to clarify your concepts.
    4. You can take any help from your provided labs.
    5. It should be clear that your assignment will not get any credit if:
      • The assignment is submitted after due date.
      • The assignment is copied from Internet or from any other student.
      • The submitted assignment does not open or file is corrupt.
      You are required to submit your solution through LMS in zip format containing following files.
       Your Project in zipped form containing both .cpp and .exe file.

    The word document (.doc/docx) or any other file format containing code will not be considered.
    If the code files are missing in zip folder, your assignment will be awarded as zero.

    Note: No assignment will be accepted after the due date through email in any case (load shedding, server down, internet malfunctioning etc.).
    It is recommended to upload solution file at least two days before its closing date.
    For any query about the assignment, contact at [email protected]

    TASK Marks=20
    This task is based on the concepts of basic transformations like translation, scaling and shearing (along x direction) of a rigid body. For this purpose, you must implement the following:

    1. You must make the pentagon having five corners as shown in figure. Mark this picture as ‘Original’.

    2. Now apply shearing along x direction with shx=4 to the original pentagon. Mark the picture as ‘Sheared along x-axis’. (Your results of shearing could be different than the picture shown as per pixels taken)

    3. Now scale the original pentagon by sx=2 and sy=3 and display it on the screen.

    4. Translate the original picture somewhere on screen. Mark it as “Translated”.

    Write a code in c++ to implement above functions. It will be a good programming practice that you implement it by creating pentagon class.

  • Cyberian's Gold

  • Cyberian's Gold

    using namespace std;	
    int main()
    	int gd, gm=DETECT;
    	initgraph(&gd, &gm, "");
    	outtextxy(60,5,"CS602 Assignment No. 2 Solution by VU ACADEMY");
    	outtextxy(10,35,"1) Original");
    	setfillstyle(XHATCH_FILL, GREEN); 
    	int arr[] = {50, 90,   80,70,   110, 90,   110, 120,   50, 120,   50,90};
    	fillpoly(6, arr); 
    	// x = x+4y
    	outtextxy(250,35,"2) Sheared Along X Axis");
    	setfillstyle(XHATCH_FILL, GREEN); 
    	//int arr2[] = {200, 70, 230,50, 260, 70, 260, 100, 200, 100, 200,70};
    	int arr2[] = {330, 90,   280,70,  390, 90,  510, 120, 450, 120, 330,90};
    	fillpoly(6, arr2); 
    	// x = 2x
    	// y = 2y
    	outtextxy(10,200,"3) Scaled");
    	setfillstyle(XHATCH_FILL, GREEN); 
    	//int arr3[] = {50, 300,    80,280,   110,300,    110, 330,   50, 330,   50,300};
    	int arr3[] = {50, 300,    110,240,   170,300,    170, 390,   50, 390,   50,300};
    	fillpoly(6, arr3); 
    	outtextxy(250,200,"1) Translated");
    	setfillstyle(XHATCH_FILL, GREEN); 
    	int arr4[] = {300, 300,   330,280,   360, 300,   360, 330,   300, 330,   300,300};
    	fillpoly(6, arr4); 
    	return 0;
Insaf Sehat Card Live Cricket Streaming
  • 1
  • 2
  • 2
  • 1
  • 4
  • 3
  • 1
  • 3
Quiz 100% Result Quiz 100% Result
| |