Monday, 28 March 2016

Computer Graphics Hands-On Lab: Mastering Circle Drawing Algorithms in C++

Computer Graphics Hands-On Lab-2: Mastering Circle Drawing Algorithms in C++
By: Dr. Zeeshan Bhatti 

Focus Keyword: Circle Drawing Algorithms

Master the art of drawing perfect circles in computer graphics! This lab project by Dr. Zeeshan Bhatti guides you through Polynomial and Bresenham's Circle Algorithms in C++, with 7 practical tasks to build your skills.

Bresenham Circle Drawing Algorithm in Computer Graphics | Circle Drawing using Algorithm 🎮07 Part-1

Computer Graphics Hands-On Lab: Mastering Line Drawing Algorithms in C++ - DDA vs. Bresenham

Computer Graphics Hands-On Lab-1 : Mastering Line Drawing Algorithms in C++ - DDA vs. Bresenham

Focus Keyword: Line Drawing Algorithms

Instructor: Dr. Zeeshan Bhatti

Polynomial Method Line Drawing in Computer Graphics | How to Draw Line using DDA algorithm in CG 🎮04

Lab Objectives

Welcome to your first computer graphics lab! This foundational session introduces you to the core problem of raster graphics: how to draw a straight line on a pixel-based display. By the end of this lab, you will:

Sunday, 27 March 2016

Computer Graphics using Java: Java Graphics Programming Lab: Mastering 2D Shapes and Geometric Primitives

Computer Graphics using Java: Java Graphics Programming: Mastering 2D Shapes and Geometric Primitives using JAva 

By: Dr. Zeeshan Bhatti

Basics of Computer Graphics | What is Computer Graphics | Computer Graphics full Course Urdu  🎮02

The Java 2D™ API provides several classes that define common geometric objects such as points, lines, curves, and rectangles. These geometry classes are part of the java.awt.geom package.

Saturday, 19 March 2016

Maya Tutorial: SET DRIVEN KEY IN MAYA

Learn how to use Maya’s set driven key feature and to set up a facial rig in this new video tutorial

Following are few quick scipts to create MEL GUI components:


create a window
 window;

  // define the layout of controls added 
  // to the window.
  columnLayout;

   // create some text
   text -label "hello world";

 // show the window we last created
 showWindow;

Slider:
attrFieldSliderGrp -min -10 -max 10 -cw 1 20 -cw 2 1 -cw 3 70
                              -at RightLeg_CTRL.AnkelRotate
                              -l aud AFD1;

Button:
button -w 70 -h 20 -label "Select All" -ann "Select all Controls" -c selAll

Symbol Button

// create window
window;
columnLayout;
   
  // create three symbol buttons with related mel command
  symbolButton -image "circle.xpm" -command "circle";
  symbolButton -image "sphere.xpm" -command "sphere";
  symbolButton -image "cube.xpm" -command "polyCube";
showWindow;


Checkbox:
checkBox -label "IK_FK" -w 30 -h 19 -ann "Switch IK FK control"
                 -onc "l_showIKFK(\"1\")"
                 -ofc "l_showIKFK(\"0\")"
                 ik_fk_switch;

example:
// create a checkbox
$c = `checkBox -label "thingy" -onCommand "on_func" -offCommand "off_func"`;
// to get the current value of the checkBox, use the -query flag
$value = `checkBox -query -value $c`;
print("check_box value = "+ $value +"\n");


Button with IMAGE:
iconTextButton -style "iconOnly" -mw 0 -mh 0 -ann "Select Hand CTRL"
                          -image1 "bbutton.bmp" -w 20 -h 20
                          -command "SelectHandCTRL(\"Left\")" 
                           selHand_Ctrl;

               

Friday, 18 March 2016

Computer Graphcis using C/C++ - Lab Handout


Computer Graphics using C/C++ -  Lab Handout 

Computer Graphics (ITEC-613 & SENG-613)

BS(IT) P-IV & BS(SW) P-IV First Semester 2016

Lab Handout: 1

By: Dr. Zeeshan Bhatti

Turbo C/C++ has a good collection of graphics libraries. If you know the basics of C/C++, you can easily learn graphics programming. To start programming, let us write a small program that displays a circle on the screen.

Simple Graphics Program 1:
/* simple.c
*/
#include<graphics.h>
#include<conio.h>

void main()
{
int gd=DETECT, gm;
clrscr();
initgraph(&gd, &gm, "c:\\tc\\bgi " );
circle(200,100,150);

getch();
closegraph();
}

To run this program, you need graphics.h header file, graphics.lib library file and Graphics driver (BGI file) in the program folder. These files are part of Turbo C package. In all our programs we used 640x480 VGA monitor. So all the programs are according to that specification. For VGA monitor, graphics driver used is EGAVGA.BGI.

Here, initgraph() function initializes the graphics mode and clears the screen.

initgraph function:


Initializes the graphics system.

Declaration:
initgraph(int far *graphdriver, int far *graphmode, char far *pathtodriver);

Remarks: To start the graphics system, you must first call initgraph.

initgraph initializes the graphics system by loading a graphics driver from disk (or validating a registered driver) then putting the system into graphics mode.

initgraph also resets all graphics settings (color, palette, current position, viewport, etc.) to their defaults, then resets graphresult to 0.
Arguments:

*graphdriver: Integer that specifies the graphics driver to be used. You can give graphdriver a value using a constant of the graphics drivers enumeration type.

*graphmode : Integer that specifies the initial graphics mode (unless *graphdriver = DETECT). If *graphdriver = DETECT, initgraph sets *graphmode to the highest resolution available for the detected driver. You can give *graphmode a value using a constant of the graphics_modes enumeration type.

pathtodriver : Specifies the directory path where initgraph looks for graphics drivers (*.BGI) first. If they're not there, initgraph looks in the current directory. If pathtodriver is null, the driver files must be in the current directory. This is also the path settextstyle searches for the stroked character font files (*.CHR).

closegraph() function:

closegraph() function switches back the screen from graphcs mode to text mode. It clears the screen also. A graphics program should have a closegraph function at the end of graphics. Otherwise DOS screen will not go to text mode after running the program. Here, closegraph() is called after getch() since screen should not clear until user hits a key.

If you have the BGI file in the same folder of your program, you can just leave it as "" only. you need not mention *graphmode if you give *graphdriver as DETECT.

To get details of different graphics modes and graphics drivers, view appendix.

In graphics mode, all the screen co-ordinates are mentioned in terms of pixels. Number of pixels in the screen decides resolution of the screen. In the example 1.0, circle is drawn with x-coordinate of the center 200, y-coordinate 100 and radius 150 pixels. All the coordinates are mentioned with respect to top-left corner of the screen.

Basic Shapes and Colors:


Now let us write a program to draw some basic shapes.
Simple Graphics Program 2:

/*
shapes.c
*/

#include<graphics.h>
#include<conio.h>

void main()
{
int gd=DETECT, gm;
int poly[12]={350,450, 350,410, 430,400, 350,350, 300,430, 350,450 };
initgraph(&gd, &gm, "");
circle(100,100,50);
outtextxy(75,170, "Circle");
rectangle(200,50,350,150);
outtextxy(240, 170, "Rectangle");
ellipse(500, 100,0,360, 100,50);
outtextxy(480, 170, "Ellipse");
line(100,250,540,250);
outtextxy(300,260,"Line");

sector(150, 400, 30, 300, 100,50);
outtextxy(120, 460, "Sector");
drawpoly(6, poly);
outtextxy(340, 460, "Polygon");
getch();
closegraph();
}


Figure 1: Here is the screenshot of output.


Here, circle() function takes x, y coordinates of the circle with respect to left top of the screen and radius of the circle in terms of pixels as arguments. Not that, in graphics, almost all the screen parameters are measured in terms of pixels.

Function outtextxy() displays a string in graphical mode. You can use different fonts, text sizes, alignments, colors and directions of the text that we will study later. Parameters passed are x and y coordinates of the position on the screen where text is to be displayed. There is another function outtext() that displayes a text in the current position. Current position is the place where last drawing is ended. These functions are declared as follows:

void far outtextxy(int x, int y, char *text);
void far outtext(char *text);

Another basic shape that we come across is a rectangle. To draw a border, use rectangle with the coordinates of outline, to draw a square use rectangle with same height and width. drawpoly() and fillpoly() are two functions useful to draw any polygons. To use these functions, store coordinates of the shape in an array and pass the address of array as an argument to the function. By looking at the output of the previous program, you can understand what drawpoly is. fillpoly is similar except that it fills in the shape with current fill color.

Declaration:

void far rectangle(int x1, int y1, int x2, int y2);

void far drawpoly(int numpoints, int far *polypoints);

void far fillpoly(int numpoints, int far *polypoints);

Remarks:

rectangle draws a rectangle in the current line style, thickness, and drawing color.

drawpoly draws a polygon using the current line style and color.

fillpoly draws the outline of a polygon using the current line style and color, then fills the polygon using the current fill pattern and fill color.

Arguments:

(x1,y1) is the upper left corner of the rectangle, and (x2,y2) is its lower right corner.

numpoints: Specifies number of points

*polypoints: Points to a sequence of (numpoints x 2) integers. Each pair of integers gives the x and y coordinates of a point on the polygon.

To draw a closed polygon with N points, numpoints should be N+1 and the array polypoints[] should contain 2(N+1) integers with first 2 integers equal to last 2 integers.

Colors :

Here is some idea about colors. There are 16 colors declared in graphics.h as listed bellow.

CPP ObjectsCPP Basic ShapesBLACK: 0
BLUE: 1
GREEN: 2
CYAN: 3
RED: 4
MAGENTA: 5
BROWN: 6
LIGHTGRAY: 7
DARKGRAY: 8
LIGHTBLUE: 9
LIGHTGREEN: 10
LIGHTCYAN: 11
LIGHTRED: 12
LIGHTMAGENTA: 13
YELLOW: 14
WHITE: 15

To use these colors, use functions setcolor(), setbkcolor() and setfillstyle(). setcolor() function sets the current drawing color. If we use setcolor(RED); and draw any shape, line or text after that, the drawing will be in red color. You can either use color as defined above or number like setcolor(4);. setbkcolor() sets background color for drawing. Setfillstyle sets fill pattern and fill colors. After calling setfillstyle, if we use functions like floodfill, fillpoly, bar etc, shpes will be filled with fill color and pattern set using setfillstyle. These function declarations are as follows

Declaration:
void far setfillstyle(int pattern, int color);
void far setcolor(int color);
void far setbkcolor(int color);

Remarks:
setfillstyle sets the current fill pattern and fill color.
setcolor sets the current drawing color to color, which can range from 0 to getmaxcolor.
setbkcolor sets the background to the color specified by color.

The parameter pattern in setfillstyle is as follows:
Names
Value
Means Fill With...
EMPTY_FILL
0
Background color
SOLID_FILL
1
Solid fill
LINE_FILL
2
---
LTSLASH_FILL
3
///
SLASH_FILL
4
///, thick lines
BKSLASH_FILL
5
\\\, thick lines
LTBKSLASH_FILL
6
\\\
HATCH_FILL
7
Light hatch
XHATCH_FILL
8
Heavy crosshatch
INTERLEAVE_FILL
9
Interleaving lines
WIDE_DOT_FILL
10
Widely spaced dots
CLOSE_DOT_FILL
11
Closely spaced dots
USER_FILL
12
User-defin


Here is an example program with colors, pixels, bar,
Simple Graphics Program 3:

/*
random.c
some graphics effects using random numbers.
*/

#include "graphics.h"
#include "conio.h"
#include "stdlib.h"

void main()
{
int gd,gm;
gd=DETECT;

initgraph(&gd, &gm, "");
setcolor(3);
setfillstyle(SOLID_FILL,RED);
bar(50, 50, 590, 430);
setfillstyle(1, 14);
bar(100, 100, 540, 380);

while(!kbhit())
{
putpixel(random(439)+101, random(279)+101,random(16));
setcolor(random(16));
circle(320,240,random(100));
}
getch();
closegraph();
}

Summary List of Graphics Functions

  1. rectangle(x1, y1, x2 , y2);
  2. line(x1, y1, x2 , y2);
  3. bar (x1, y1, x2 , y2);
  4. 3dbar(x1, y1, x2 , y2 , depth, topFlag);
  5. circle(x, y, radius);
  6. putpixel(x, y);
  7. ellipse(x, y, start, end, xRadius, yRadius);
  8. arc(x1, y1, x2, y2, radius);
  9. outtext(“Text”);
  10. outtextxy(x, y, “Text”);
  11. settextstyle(fontStyle, Direction, CharSize); // Direction = 0 or 1
ie: settextstyle(1,0,7);
  1. setfillstyle(pattern, color);
  2. floodfill(x, y, boarderColor);
  3. setbkcolor(colorNo); // Cgange the background color of the dos window
  4. setColor(colorNo); // set the color of the text or objects
  5. setlinestyle(type, pattern, thickness); // type = 1 – 5, thickness= 1-3
  6. kbhit(); // keyboard hit: any key pressed from the keyboard, like getche();

Wednesday, 16 March 2016

How to write a Research Proposal? What to write in a Research Proposal?

How to write a Research Proposal?
What to write in a Research Proposal?


Research Proposal Writing

First, let’s define what research is? According to my understanding and knowledge of the subjectresearch can be defined as

It is a process involving systematic and controlled investigation of a problem, using multiple materials, resources, references and experiments, with aim to better understand and provide an agreeably valid and relevant new solution to that problem, with new or better outcomesand improved results reaching to an exclusive novel conclusion.” {Dr. Zeeshan Bhatti}

A Research proposal is a comprehensive statement or document of research programme and plan, that each student has to carry out. Writing a research proposal can be a daunting task, if the student is not aware of few intricate details about what to put in a research proposal. Research proposal can be of multiple types and for numerous reasons. For example,you may need to write a research proposal for Masters/MPhil, PhD, for applying in a university, for scholarship, for grants or funding, or for any other academic reason. Each of these types mentioned has their own formats and standardised requirements. In this article, I will discuss the basic generalized format and requirements regarding writing a research proposal, and what to put inside it.

In order to write a research proposal, few general and basic things are needed but are not extremely important in the beginning.

1. Introduction or background of the field:  Give brief overview of the area/field of research with specific information over the topic of the proposal.

2. Literature Review: Literature review or survey of previously published research papers, from last five years is recommended but at this level you can search and include papers from last 10 years. For Proposal, number of papers can be between 10 to 20.

3. Problem Definition: What is the problem? Is it identified through the literature survey or through supervisor or through your own experience? (It is not necessary that you know the exact solution of the problem at this point).Problem Definition, Problem Statement. 

4. Research Objectives: Identify and list the research Questions and Hypothesis. Provide 3 to 5 Key achievable goals or targets to be achieved. 

                 5. Scope: This part usually involves - what is to be considered and covered in research? How much  
                 the problem is expected to be solved, what are the parameters needed for the research work.

6. Methodology: This involves one or more than one method, algorithm or techniquerequired and will be used to solve the problem. Formulate your research design, provide, flowcharts, system diagrams, etc. as necessary.Explain the methods used in study such as library research, lab work, field work, historical documentary, interview, survey, evaluation and analysis, etc.

7. Testing and Analysis:  very important part is the analysis and testing the results- now this depends upon the research design. At this point, just define how you plan to test, evaluate and validate your results. 

8. Conclusion: Expected outcome, this is the result yet expected.

9. References: other things involve are the references, citation and so on.



The above is a brief format for a proposal. Many this can be added or removed from it as appropriate and depending on the subject area of research. The aim here is to generalize a set of guidelines that would facilitate each researcher in writing their research proposals. 

Based on these guidelines, following simple template has been designed to further assist each student in writing and formatting their proposals. It should be within 12 – 20 pages, containing words between 6000 to 10000



TEMPLATE FOR RESEARCH PROPOSAL

 

COVER PAGE
MASTER /PHD Research PROPOSAL 
Topic
Prepared by
Matric No
Supervised by
Date Submitted

CONTENT
                  Abstract
1. Introduction
1.1 Overview
1.2 Problem Definition
1.3 Problem Statement
1.4 Research Objectives
1.5 Scope (What your research will cover)
1.6 Significance of your Research / Scientific Contribution

2. Literature Review
2.1 Introduction
2.2 Review of past research

3. Research Methodology
3.1 Research Design / Plan 
3.2 System Architecture / Overview
3.3 Algorithms/ Techniques / Survey / Interviews
3.4 Testing /Validation / Evaluation

4. Conclusion
4.1 Preliminary Findings ( if any)
4.2 Conclusion and Plan of Work

5. References

DR. ZEESHAN BHATTI
3

Research Proposal Template

Friday, 11 March 2016

IT Project Management - Assignment

IT Project Management  ITEC-806 

MPhil (IT) - Course Assignmen

By: Dr. Zeeshan Bhatti
IT Project Management - Assignment

Please do the task as discussed and explained below, and show the progress of your assignment weekly during the class. Please note that currently you are not asked to submit the assignment, as this is an ongoing assignment and will include few more tasks. The final submission will be in form of PC-1 once the course is complete.
 

Task 1:

Each Student is required to think/choose 3 (THREE) project ideas of various types. Each project type has to belong from on of the following categories. At this stage just think of the project titles or types based on your interest, profession, future aim. In further tasks we will be working on these idea and learn how to plan and manage these project ideas of each individual.
Following are the 3 categories from which you are required to choose an idea for a project.
1. Research Project
2. Software Development
3. Business Project.

Task 2:

Once you have chosen a project idea, now you are required to prepare a small feasibility and requirement report of each project based on following parameters.

Defines the following for each of your project idea's:-
  1. Project Objectives,
  2. Scope of project,
  3. Deliverables/ objectives or key targets of the project.
  4. Stakeholders (Internal & External)
  5. Work to be done (WBS)
  6. Project Organization and Resources (OBS)
  7. Project Costings (CBS)
  8. Project Schedule
  9. Procurement/Contract Strategy
  10. Risk Management
  11. Quality management
  12. Change Management

Task 3:

Develop you own Project Process Model (as discussed in Lecture 3, Chapter 2) for your choice of projects from task 1. Based on your ideas, develop your own custom process model with your own choice or parameters and phases.

Note the idea is to design and develop a new model for each of your project. If the project is designed well enough, the next phase will be to write a research paper, published this model in a research paper. Therefor, try to do little background research and carefully plan your model.

Each of you should have selected 3 project ideas from task 1, now the Project Process Model that you have just designed, use that same model on all three different categories of projects that you choose, and try answering the following questions

Q1. Apply the the process model on your project and see how successful it is.
Q2. Apply same process model on all three projects and see if it is feasible and
would work for all three or not.
Q3. Do you need 3 separate process models for each of the projects?
Q4. What would changes, modifications, you need to do in-order to ensure that
same single process model would be suitable and perfect for all three
categories?
Q5. What could be the reason, factors, circumstances under which your process
model would not work or will fail?


Submission:

Submission Date: End of Semester as Final PC-I form.

Featured post

👉 🔥 Master Full Stack Web Development | Week-1 Lecture-1 - HTML & Frontend vs Backend, Dr. Zeeshan Bhatti

  Hey there, future coders! Welcome to the most exciting journey of your life. I'm  Dr. Zeeshan Bhatti  from  Zeeshan Academy , and you...