CG - MANUAL (18 Scheme) bmk2021
CG - MANUAL (18 Scheme) bmk2021
SYLLABUS
Part A
SL NO PROGRAMS
02 Create and rotate a triangle about the origin and a fixed point
04 Draw a color cube and allow the user to move the camera suitably to experiment with
perspective viewing
06 To draw a simple shaded scene consisting of a tea pot on a table. Define suitably the
position and properties of the light source along with the properties of the surfaces of the
solid object used in the scene
08 Develop a menu driven program to animate a flag using Bezier Curve algorithm
09 Develop a menu driven program to fill the polygon using scan line algorithm
voi
d glFrustum(GLdouble left, GLdouble right, GLdoublebottom,GLdouble top, GLdouble near,
GLdouble far);
void
glOrtho(GLdouble left, GLdouble right, GLdouble bottom,
GLdouble top, GLdouble near, GLdouble far);
OpenGL Conventions
• Many functions have multiple forms:
glVertex2f, glVertex3i, glVertex4dv, etc.
OpenGL Primitives
glMatrixMode
• glMatrixMode
– - specify which matrix is the current matrix
• C Specification
– void glMatrixMode( GLenummode )
• Parameters
– mode Specifies which matrix stack is the
target for subsequent matrix operations. Three values are accepted:
GL_MODELVIEW, GL_PROJECTION, and GL_TEXTURE. The
default value is GL_MODELVIEW.
• Description
– glMatrixMode sets the current matrix mode. mode can assume one of
three values: GL_MODELVIEW Applies subsequent matrix operations to
C:\WINDOWS\System\
glut32.dll
If you plan on giving your program to friends to run using Windows, you must also
include the glut32.dll file. If they don't have this file in the same directory as your
Experiment 1: Implement Brenham’s line drawing algorithm for all types of slope
AIM:
Write a program to implement Bresenham’s line drawing algorithm withal values of
slopes
ALGORITHM:
Bresenham's Line-DrawingAlgorithm.
Step 1 - Input the two end-points of line, storing the left end-point in (x0,y0).
Step 3 - Calculate the constants dx, dy, 2dy, and (2dy – 2dx) and get the first value for the
decision parameter as -
p0=2dy-dx
Step 4 - At each Xk along the line, starting at k = 0, perform the following test -
Otherwise, (xk,yk+1)
pk+1=pk+2dy-2dx
For m > 1, find out whether you need to increment x while incrementing y each time.
PROGRAM:
#include<math.h>
#include<stdio.h>
#include<stdlib.h>
#include<GL/glut.h>
GLintxi,yi,xk,yk;
void plot_point(GLintx,GLint y){
glColor3f(1.0,0.0,0.0);
glPointSize(4);
glBegin(GL_POINTS);
glVertex2i(x,y);
glEnd();
glFlush();
}
void BresenhamlineDrawing()
{
GLint pk;
GLintdy=yk-yi;
GLint dx=xk-xi;
float m;
if(xi!=xk&&yi!=yk)
{
printf("Next pk\t\t Next xi\t Next yi\n");
m=(float)dy/(float)dx;
if(m>0)
{
plot_point(xi,yi);
if(abs(m)<=1)
{
pk=2*dy-dx;
while(xi<xk)
{
if(pk<=0)
{
pk=pk+2*dy;
xi++;
printf("%2d\t\t %2d\t\t %2d\n",pk,xi,yi);
plot_point(xi,yi);
}
if(pk > 0){
pk=pk+2*(dy-dx);
xi++;
yi++;
plot_point(xk,yk);
}
}
}
if(abs(m)>1){
pk=-dy-2*dx;
while(yk<yi)
{
if(pk>0)
{
pk=pk+(-2*dx);
yk++;
printf("%3d\t\t %3d\t\t %3d\n",pk,xk,yk);
plot_point(xk,yk);
}
if(pk<=0){
pk=pk+2*(-dy-dx);
xk--;
yk++;
printf("%3d\t\t %3d\t\t %3d\n",pk,xk,yk);
plot_point(xk,yk);
}
}
}
}
}
else if(xi==xk){
while(yi<yk){
yi++;
printf("Next xi\t\t Next yi\n");
printf("%3d\t\t %3d\n",xi,yi);
plot_point(xi,yi);
}
}
else if(yi==yk)
{
while(xi<xk)
{
xi++;
printf("Next xi\t\t Next yi\n");
printf("%3d\t\t %3d\n",xi,yi);
plot_point(xi,yi);
}
}
}
void display(void){
glClear(GL_COLOR_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(-50.0,50.0,-50.0,50.0);
BresenhamlineDrawing();
}
Sample Output:
Experiment 2:Create and rotate a triangle about the origin and a fixed point
AIM:
Write a program to Create and rotate a triangle about the origin and a fixed point.
PROGRAM:
#include<stdio.h>
#include<math.h>
#include<GL/glut.h>
GLfloatt[3][3]={{10.0,30.0,20.0},{20.0,20.0,40.0},{1.0,1.0,1.0}};
GLfloatrotatemat[3][3]={{0},{0},{0}};
GLfloatresult[3][9]={{0},{0},{0}};
GLfloatxr=10.0;
GLfloatyr=20.0;
GLfloat theta;
GLintch;
void multiply(){
int i,j,k;
for(i=0;i<3;i++)
for(j=0;j<9;j++){
result[i][j]=0;
for(k=0;k<3;k++)
result[i][j]=result[i][j]+rotatemat[i][k]*t[k][j];
}
}
void rotate_about_origin(){
rotatemat[0][0]=cos(theta);
rotatemat[0][1]=-sin(theta);
rotatemat[0][2]=0;
rotatemat[1][0]=sin(theta);
rotatemat[1][1]=cos(theta);
rotatemat[1][2]=0;
rotatemat[2][0]=0;
rotatemat[2][1]=0;
rotatemat[2][2]=1;
multiply();
}
void rotate_about_fixed_point(){
GLfloatm,n;
m=xr*(1-cos(theta))+yr*sin(theta);
n=yr*(1-cos(theta))-xr*sin(theta);
rotatemat[0][0]=cos(theta);
rotatemat[0][1]=-sin(theta);
rotatemat[0][2]=m;
rotatemat[1][0]=sin(theta);
rotatemat[1][1]=cos(theta);
rotatemat[1][2]=n;
rotatemat[2][0]=0;
rotatemat[2][1]=0;
rotatemat[2][2]=1;
multiply();
}
void draw_triangle(){
glLineWidth(10);
glBegin(GL_LINE_LOOP);
glColor3f(1.0,0.0,0.0);
glVertex2f(t[0][0],t[1][0]);
glColor3f(0.0,1.0,0.0);
glVertex2f(t[0][1],t[1][1]);
glColor3f(0.0,0.0,1.0);
glVertex2f(t[0][2],t[1][2]);
glEnd();
glFlush();
}
void draw_rotated_triangle(){
glLineWidth(10);
glBegin(GL_LINE_LOOP);
glColor3f(1.0,0.0,0.0);
glVertex2f(result[0][0],result[1][0]);
glColor3f(0.0,1.0,0.0);
glVertex2f(result[0][1],result[1][1]);
glColor3f(0.0,0.0,1.0);
glVertex2f(result[0][2],result[1][2]);
glEnd();
glFlush();
}
void display(){
glClear(GL_COLOR_BUFFER_BIT);
if(ch==1){
draw_triangle();
rotate_about_origin();
draw_rotated_triangle();
glFlush();
}
if(ch==2){
draw_triangle();
rotate_about_fixed_point();
draw_rotated_triangle();
glFlush();
}
}
void myinit(){
glClearColor(1.0,1.0,1.0,1.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(-50.0,50.0,-50.0,50.0);
}
Sample Output :
Experiment 3:
Draw a color cube and spin it using OpenGL transformation matrices
AIM:
Write a program to Draw a color cube and spin it using OpenGL transformation
matrices
PROGRAM:
#include<stdio.h>
#include<GL/glut.h>
GLfloat vertices[][3]={{-1.0,-1.0,-1.0},{1.0,-1.0,-1.0},{1.0,1.0,-1.0},{-1.0,1.0,-1.0},{-1.0,-1.0,1.0},{1.0,-
1.0,1.0},{1.0,1.0,1.0},{-1.0,1.0,1.0}};
GLfloatcolors[][3]={{0.0,0.0,0.0},{1.0,0.0,0.0},{1.0,1.0,-
1.0},{0.0,1.0,0.0},{0.0,0.0,1.0},{1.0,0.0,1.0},{1.0,1.0,1.0},{0.0,1.0,1.0}};
void colorcube(void){
polygon(0,1,2,3);
polygon(0,4,7,3);
polygon(0,1,5,4);
polygon(1,5,6,2);
polygon(3,2,6,7);
polygon(4,5,6,7);
}
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glL
S.J.B.I.T Dept of CSE Page 22
18CSL68 Computer Graphics and Mini Project Laboratory
glRotatef(theta[0],1.0,0.0,0.0);
glRotatef(theta[1],0.0,1.0,0.0);
glRotatef(theta[2],0.0,0.0,1.0);
colorcube();
glFlush();
glutSwapBuffers();
}
void spinCube(){
theta[axis]+=0.1;
if(theta[axis>360.0]) theta[axis]-=360.0;
glutPostRedisplay();
}
Experiment 4:
Draw a color cube and allow the user to move the camera suitably to experiment
with perspective viewing.
AIM:
Write a program to Draw a color cube and allow the user to move the camera
suitably to experiment with perspective viewing.
PROGRAM:
#include<stdio.h>
#include<GL/glut.h>
GLfloat vertices[][3]={{-1.0,-1.0,-1.0},{1.0,-1.0,-1.0},{1.0,1.0,-1.0},{-1.0,1.0,-1.0},{-1.0,-1.0,1.0},{1.0,-
1.0,1.0},{1.0,1.0,1.0},{-1.0,1.0,1.0}};
GLfloatcolors[][3]={{0.0,0.0,0.0},{1.0,0.0,0.0},{1.0,1.0,-
1.0},{0.0,1.0,0.0},{0.0,0.0,1.0},{1.0,0.0,1.0},{1.0,1.0,1.0},{0.0,1.0,1.0}};
void polygon(int a,intb,intc,int d){
glBegin(GL_POLYGON);
glColor3fv(colors[a]);
glVertex3fv(vertices[a]);
glColor3fv(colors[b]);
glVertex3fv(vertices[b]);
glColor3fv(colors[c]);
glVertex3fv(vertices[c]);
glColor3fv(colors[d]);
glVertex3fv(vertices[d]);
glEnd();
}
void colorcube(void){
polygon(0,1,2,3);
polygon(0,4,7,3);
polygon(0,1,5,4);
polygon(1,5,6,2);
polygon(3,2,6,7);
polygon(4,5,6,7);
polygon(0,1,5,4);
}
static GLfloattheta[] = {0.0,0.0,0.0};
static GLint axis=2;
static GLdoubleviewer[] = {0.0,0.0,0.5};
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
gluLookAt(viewer[0],viewer[1],viewer[2],0.0,0.0,0.0,0.0,1.0,0.0);
glRotatef(theta[0],1.0,0.0,0.0);
glRotatef(theta[1],0.0,1.0,0.0);
glRotatef(theta[2],0.0,0.0,1.0);
colorcube();
glFlush();
glutSwapBuffers();
}
void mouse(int btn,intstate,intx,int y){
if(btn==GLUT_LEFT_BUTTON && state == GLUT_DOWN) axis=0;
if(btn==GLUT_MIDDLE_BUTTON && state == GLUT_DOWN) axis=1;
if(btn==GLUT_RIGHT_BUTTON && state == GLUT_DOWN) axis=2;
theta[axis]+=2.0;
if(theta[axis]>360.0) theta[axis]-=360.0;
display();
}
void keys(unsigned char key,intx,int y){
if(key=='x') viewer[0]-=1.0;
if(key=='X') viewer[0]+=1.0;
if(key=='y') viewer[1]-=1.0;
if(key=='Y') viewer[1]+=1.0;
if(key=='z') viewer[2]-=1.0;
if(key=='Z') viewer[3]+=1.0;
display();
}
void myReshape(int w,int h){
glViewport(0,0,w,h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
if(w<=h)
glFrustum(-2.0,2.0,-2.0*(GLfloat)h/(GLfloat)w,2.0*(GLfloat)h/(GLfloat)w,2.0,20.0);
else
glFrustum(-2.0,2.0,-2.0*(GLfloat)w/(GLfloat)h,2.0*(GLfloat)w/(GLfloat)h,2.0,20.0);
glMatrixMode(GL_MODELVIEW);
}
void main(int argc,char** argv){
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB|GLUT_DEPTH);
glutInitWindowSize(500,500);
glutCreateWindow("ColorCube");
glutReshapeFunc(myReshape);
glutDisplayFunc(display);
glutKeyboardFunc(keys);
glutMouseFunc(mouse);
glEnable(GL_DEPTH_TEST);
glutMainLoop();
} Sample Output:
Experiment 5:
Clip a lines using Cohen-Sutherland algorithm.
AIM:
Write a program to Clip a lines using Cohen-Sutherland algorithm.
ALGORITHM:
Cohen-sutherland line clipping Algorithm
To perform the trivial acceptance and rejection tests, we extend the edges of the window to
divide the plane of the window into the nine regions. Each end point of the line segment is
then assigned the code of the region in which it lies.
and
1. Given a line segment with endpoint
2. Compute the 4-bit codes for each endpoint.
If both codes are 0000,(bitwise OR of the codes yields 0000 ) line lies completely
inside the window: pass the endpoints to the draw routine.
If both codes have a 1 in the same bit position (bitwise AND of the codes is not 0000),
the line lies outside the window. It can be trivially rejected.
3. If a line cannot be trivially accepted or rejected, at least one of the two endpoints must
lie outside the window and the line segment crosses a window edge. This line must be
clipped at the window edge before being passed to the drawing routine.
4. Examine one of the endpoints, say . Read 's 4-bit code in order: Left-
to-Right, Bottom-to-Top.
5. When a set bit (1) is found, compute theintersectionI of the corresponding window
edge with the line from to . Replace with I and repeat the algorithm.
PROGRAM:
#include<windows.h>
#include <stdio.h>
#include <GL/glut.h>
#define outcode int
GLfloatxmin,ymin,xmax,ymax;
GLfloatxvmin,yvmin,xvmax,yvmax;
GLfloat x0,y0,x1,y1;
const int LEFT = 1;
const int RIGHT = 2;
const int BOTTOM = 4;
const int TOP = 8;
outcodeComputeOutCode (double x, double y);
void CohenSutherlandLineClipAndDraw ()
{
double x, y;
outcodeOut = outcode0? outcode0: outcode1;
if (outcodeOut& TOP)
{
x = x0 + (x1 - x0) * (ymax - y0)/(y1 - y0);
y = ymax;
}
else if (outcodeOut& BOTTOM)
{
x = x0 + (x1 - x0) * (ymin - y0)/(y1 - y0);
y = ymin;
}
S.J.B.I.T Dept of CSE Page 29
18CSL68 Computer Graphics and Mini Project Laboratory
void myinit()
{
glClearColor(1.0,1.0,1.0,1.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(-1000.0,1000.0,-1000.0,1000.0);
}
Experiment 6:
To draw a simple shaded scene consisting of a tea pot on a table. Define suitably the
position and properties of the light source along with the properties of the surfaces
of the solid object used in the scene.
AIM:
Write a program to draw a simple shaded scene consisting of a tea pot on a table.
Define suitably the position and properties of the light source along with the
properties of the surfaces of the solid object used in the scene.
PROGRAM
#include <GL/glut.h>
voiddisplaySolid (void)
{
//set properties of the surface material
GLfloatmat_ambient[] = {0.7f, 0.7f, 0.7f, 1.0f}; // gray
GLfloatmat_diffuse[] = {.5f, .5f, .5f, 1.0f};
GLfloatmat_specular[] = {1.0f, 1.0f, 1.0f, 1.0f};
GLfloatmat_shininess[] = {50.0f};
glMaterialfv (GL_FRONT, GL_AMBIENT, mat_ambient);
glMaterialfv (GL_FRONT, GL_DIFFUSE, mat_diffuse);
glMaterialfv (GL_FRONT, GL_SPECULAR, mat_specular);
glMaterialfv (GL_FRONT, GL_SHININESS, mat_shininess);
//start drawing
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glTranslated (0.4, 0.4, 0.6);
glRotated (45, 0, 0, 1);
glScaled (0.08, 0.08, 0.08);
glPopMatrix();
glPushMatrix();
glTranslated (0.6, 0.38, 0.5);
glRotated (30, 0, 1, 0);
glutSolidTeapot (0.08);
glPopMatrix ();
glPushMatrix();
glTranslated (0.25, 0.42, 0.35); //glutSolidSphere (0.1, 15, 15);
glPopMatrix();
glPushMatrix();
glTranslated (0.4, 0, 0.4);
table (0.6, 0.02, 0.02, 0.3);
glPopMatrix();
wall (0.02);
glPushMatrix();
glRotated (90.0, 0.0, 0.0, 1.0);
wall (0.02);
glPopMatrix();
glPushMatrix();
glRotated (-90.0, 1.0, 0.0, 0.0);
wall (0.02);
glPopMatrix();
glFlush();
}
OR
#include<gl/glut.h>
void obj(double tx,doublety,doubletz,doublesx,doublesy,doublesz)
{
glRotated(50,0,1,0); glRotated(10,-1,0,0);
glRotated(11.7,0,0,-1);
glTranslated(tx,ty,tz); glScaled(sx,sy,sz);
glutSolidCube(1);
glLoadIdentity();
}
void display()
{
glViewport(0,0,700,700);
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
Experiment 7:
Design, develop and implement recursively subdivide a tetrahedron to form 3D
sierpinski gasket. The number of recursive steps is to be specified by the user.
AIM:
Write a program to Design, develop and implement recursively subdivide a
tetrahedron to form 3D sierpinski gasket. The number of recursive steps is to be
specified by the user..
PROGRAM
#include<stdio.h>
#include<GL/glut.h>
glBegin(GL_POLYGON);
glVertex3fv(a);
glVertex3fv(b);
glVertex3fv(c);
glEnd();
}
void tetrahedron(int m)
{
glColor3f(1.0,0.0,0.0);
divide_triangle(v[0],v[1],v[2],m);
glColor3f(0.3,0.3,0.3);
divide_triangle(v[3],v[2],v[1],m);
glColor3f(0.0,0.0,1.0);
divide_triangle(v[0],v[3],v[1],m);
glColor3f(0.0,1.0,0.0);
divide_triangle(v[0],v[2],v[3],m);
glFlush();
}
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
tetrahedron(n);
}
void myReshape(int w,int h)
{
glViewport(0,0,w,h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
if(w<=h)
glOrtho(-2.0,2.0,-2.0*(GLfloat)h/(GLfloat)w,2.0*(GLfloat)h/(GLfloat)w,-10.0,10.0);
else
glOrtho(-2.0*(GLfloat)w/(GLfloat)h,2.0*(GLfloat)w/(GLfloat)h,-2.0,2.0,-10.0,10.0);
glMatrixMode(GL_MODELVIEW);
glutPostRedisplay();
}
int main(int argc,char** argv)
{
printf("Enter the number of division:");
scanf("%d",&n);
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB|GLUT_DEPTH);
glutInitWindowSize(640,480);
glutCreateWindow("3D Gasket");
glutReshapeFunc(myReshape);
glutDisplayFunc(display);
glEnable(GL_DEPTH_TEST);
glClearColor(1.0,1.0,1.0,1.0);
glutMainLoop();
return 0;
}
Sample Output:
Experiment 8:
Develop a menu driven program to animate a flag using Bezier Curve algorithm.
AIM:
Write a program to develop a menu driven program to animate a flag using Bezier
Curve algorithm
PROGRAM
#include<GL/glut.h>
#include<stdio.h>
#include<math.h>
#define PI 3.1416
void CreateMenu(void);
void Menu(int value);
struct wcPt3D
{
GLfloat x, y, z;
};
void CreateMenu(void)
{
CMenu= glutCreateMenu(Menu);//Creaate Menu Option
glutAddMenuEntry("Indian Flag",1);
glutAddMenuEntry("Karnataka Flag",2);
glutAddMenuEntry("Exit",0);
glutAttachMenu(GLUT_RIGHT_BUTTON);
glutInitWindowSize(winWidth, winHeight);
glutCreateWindow("Prg. 8 Bezier Curve");
CreateMenu(); glutDisplayFunc(displayFcn);
glutReshapeFunc(winReshapeFun); glutMainLoop();
}
Sample Output:
Experiment 9:
Develop a menu driven program to fill the polygon using scan line algorithm.
AIM:
Write a program to Develop a menu driven program to fill the polygon using scan
line algorithm.
ALGORITHM:
Step 1 − Find out the Ymin and Ymax from the given polygon.
Step 2 − ScanLine intersects with each edge of the polygon from Ymin to Ymax. Name
each intersection point of the polygon. As per the figure shown above, they are named as
p0, p1, p2, p3.
Step 3 − Sort the intersection point in the increasing order of X coordinate i.e. (p0, p1), (p1,
p2), and (p2, p3).
Step 4 − Fill all those pair of coordinates that are inside polygons and ignore the alternate pairs.
PROGRAM
#include<stdlib.h>
#include<stdio.h>
#include<GL/glut.h>
float x1=200.0,y1=200.0,x2=100.0,y2=300.0,x3=200.0,y3=400.0,x4=300.0,y4=300.0;
void scanfill(float x1,float y1,float x2,float y2,float x3,float y3,float x4,float y4){
int le[500],re[500];
int i,y;
for(i=0;i<500;i++){
le[i]=500;
re[i]=0;
}
edgedetect(x1,y1,x2,y2,le,re);
edgedetect(x2,y2,x3,y3,le,re);
edgedetect(x3,y3,x4,y4,le,re);
edgedetect(x4,y4,x1,y1,le,re);
for(y=0;y<500;y++){
if(le[y]<=re[y])
for(i=(int)le[y];i<(int)re[y];i++)
drawpixel(i,y);
}
}
void drawpoly(){
glColor3f(0,0,1);
glBegin(GL_LINE_LOOP);
glVertex2f(x1,y1);
glVertex2f(x2,y2);
glVertex2f(x3,y3);
glVertex2f(x4,y4);
glEnd();
glFlush();
}
void display(){
glClear(GL_COLOR_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0,499,0,499);
}
glutAttachMenu(GLUT_RIGHT_BUTTON);
glutMainLoop();
return 0;
}
Sample Output:
Viva questions
1. What is scan conversion?
A major task of the display processor is digitizing a picture definition given in an application program into a
set of pixel-intensity values for storage in the frame buffer. This digitization process is called scan
conversion.
3. What is rasterization?
The process of determining the appropriate pixels for representing picture or graphics object is known as
rasterization.
6. Write the two techniques for producing color displays with a CRT?
Beam penetration method, shadow mask method.
scan display, at the end of one frame, the electron beam returns to the left top corner of the screen to start the
next frame.
9. What is bitmap?
Some system has only one bit per pixel; the frame buffer is often referred to as bitmap.
10. Differentiate plasma panel display and thin film electro luminescent display?
In plasma panel display, the region between two glass plates is filled with neon gas. In thin film electro
luminescent display, the region between two glasses plates are filled with phosphor, such as zinc sulphide
doped with manganese.
19. What
S.J.B.I.T Dept of CSE Page 48
18CSL68 Computer Graphics and Mini Project Laboratory
30. Define
S.J.B.I.T Dept of CSE Page 49
18CSL68 Computer Graphics and Mini Project Laboratory
Circle?
Circle is defined by its center xc, yc and its radius in user coordinate units. The equation of the circle is (x-
xc) + (yyc)= r2.
40. A point (4,3) is rotated counterclockwise by an angle of 45°. Find the rotation matrix and the
resultant
point