SlideShare a Scribd company logo
EXPERIMENT
Objective: - Write a program to perform translation.
Software Used: - Turbo c
Theory: - To translate an object by a vector v, each homogeneous vector p (written in
homogeneous coordinates) would need to be multiplied by thistranslation matrix:
As shown below, the multiplication will give the expected result:
Program :
#include <stdio.h>
#include <stdlib.h>
#include<graphics.h>
#include<conio.h>
#include<math.h>
void draw2d(int,int [],int [],int,int);
void main()
{
int gd=DETECT, gm;
int x[20],y[20],tx=0,ty=0,i,fs;
initgraph(&gd,&gm," C:TURBOC3BIN");
printf("No of edges : ");
scanf("%d",&fs);
printf("Co-ordinates : ");
for(i=0;i<fs;i++)
{
printf("(x%d,y%d)",i,i);
scanf("%d%d",&x[i],&y[i]);
}
draw2d(fs,x,y,tx,ty);
printf("translation (x,y) : ");
scanf("%d%d",&tx,&ty);
draw2d(fs,x,y,tx,ty);
getch();
}
void draw2d(int fs,int x[20],int y[20],int tx,int ty)
{
int i;
for(i=0;i<fs;i++)
{
if(i!=(fs-1))
line(x[i]+tx,y[i]+ty,x[i+1]+tx,y[i+1]+ty);
else
line(x[i]+tx,y[i]+ty,x[0]+tx,y[0]+ty);
}
}
Output:
Write a program to perform translation

More Related Content

What's hot

Bcsl 033 data and file structures lab s5-3
Bcsl 033 data and file structures lab s5-3Bcsl 033 data and file structures lab s5-3
Bcsl 033 data and file structures lab s5-3
Dr. Loganathan R
 
Ffffffffffff
FfffffffffffFfffffffffff
Ffffffffffffmohdshanu
 
C program to add two numbers
C program to add two numbers C program to add two numbers
C program to add two numbers
mohdshanu
 
C program to add n numbers
C program to add n numbers C program to add n numbers
C program to add n numbers
mohdshanu
 
Program for pyramid
Program for pyramidProgram for pyramid
Program for pyramidnayakq
 
C Programming Example
C Programming ExampleC Programming Example
C Programming Example
PRATHAMESH DESHPANDE
 
C Programming Example
C Programming Example C Programming Example
C Programming Example
University of Potsdam
 
C++ 4
C++ 4C++ 4
C++ 4
Syed Umair
 
Bti1022 lab sheet 9 10
Bti1022 lab sheet 9 10Bti1022 lab sheet 9 10
Bti1022 lab sheet 9 10alish sha
 
C programs Set 2
C programs Set 2C programs Set 2
C programs Set 2
Koshy Geoji
 
Bcsl 033 data and file structures lab s2-3
Bcsl 033 data and file structures lab s2-3Bcsl 033 data and file structures lab s2-3
Bcsl 033 data and file structures lab s2-3
Dr. Loganathan R
 
Binary addition using class concept in c++
Binary addition using class concept in c++Binary addition using class concept in c++
Binary addition using class concept in c++
Swarup Boro
 
Dti2143 lab sheet 9
Dti2143 lab sheet 9Dti2143 lab sheet 9
Dti2143 lab sheet 9alish sha
 
Operators and expression in c#
Operators and expression in c#Operators and expression in c#
Operators and expression in c#
Dr.Neeraj Kumar Pandey
 

What's hot (15)

Bcsl 033 data and file structures lab s5-3
Bcsl 033 data and file structures lab s5-3Bcsl 033 data and file structures lab s5-3
Bcsl 033 data and file structures lab s5-3
 
Ffffffffffff
FfffffffffffFfffffffffff
Ffffffffffff
 
C program to add two numbers
C program to add two numbers C program to add two numbers
C program to add two numbers
 
C program to add n numbers
C program to add n numbers C program to add n numbers
C program to add n numbers
 
Program for pyramid
Program for pyramidProgram for pyramid
Program for pyramid
 
C Programming Example
C Programming ExampleC Programming Example
C Programming Example
 
C Programming Example
C Programming Example C Programming Example
C Programming Example
 
C++ 4
C++ 4C++ 4
C++ 4
 
Bti1022 lab sheet 9 10
Bti1022 lab sheet 9 10Bti1022 lab sheet 9 10
Bti1022 lab sheet 9 10
 
C programs Set 2
C programs Set 2C programs Set 2
C programs Set 2
 
Shan
ShanShan
Shan
 
Bcsl 033 data and file structures lab s2-3
Bcsl 033 data and file structures lab s2-3Bcsl 033 data and file structures lab s2-3
Bcsl 033 data and file structures lab s2-3
 
Binary addition using class concept in c++
Binary addition using class concept in c++Binary addition using class concept in c++
Binary addition using class concept in c++
 
Dti2143 lab sheet 9
Dti2143 lab sheet 9Dti2143 lab sheet 9
Dti2143 lab sheet 9
 
Operators and expression in c#
Operators and expression in c#Operators and expression in c#
Operators and expression in c#
 

Viewers also liked

1st birthday baby gifts
1st birthday baby gifts1st birthday baby gifts
1st birthday baby gifts
Jeff Mccoy
 
Artile plan
Artile planArtile plan
Artile plan
Jayna Gibbs
 
Fp me reporte 2 aplicación.lucy suarez. actividad 2
Fp me reporte 2  aplicación.lucy suarez. actividad 2Fp me reporte 2  aplicación.lucy suarez. actividad 2
Fp me reporte 2 aplicación.lucy suarez. actividad 2
Lucy Suarez R
 
Modulator dan demodulator
Modulator dan demodulatorModulator dan demodulator
Modulator dan demodulator
soeryaa
 
Kestabilan absolut
Kestabilan absolutKestabilan absolut
Kestabilan absolut
soeryaa
 
Lyapunov
LyapunovLyapunov
Lyapunov
soeryaa
 
Pencapaian unit rt n srs 2015 kursus ert
Pencapaian unit rt n srs 2015 kursus ertPencapaian unit rt n srs 2015 kursus ert
Pencapaian unit rt n srs 2015 kursus ert
Alxander Hakim
 
Program residen
Program residenProgram residen
Program residen
soeryaa
 
Program residen
Program residenProgram residen
Program residen
soeryaa
 
Vectores
VectoresVectores
Protocolo reporte actividad 4 de aplicación aamtic abril20
Protocolo reporte  actividad 4 de aplicación aamtic abril20Protocolo reporte  actividad 4 de aplicación aamtic abril20
Protocolo reporte actividad 4 de aplicación aamtic abril20
Lucy Suarez R
 
Gomeralcontin windows 7 installation
Gomeralcontin windows 7 installationGomeralcontin windows 7 installation
Gomeralcontin windows 7 installation
gomeralcontin
 
Ionic app
Ionic appIonic app
Ionic app
Shobhit Saxena
 
Proses dan jenis interupsi
Proses dan jenis interupsiProses dan jenis interupsi
Proses dan jenis interupsi
soeryaa
 
Keyboard
KeyboardKeyboard
Keyboard
soeryaa
 
Kriteria kestabilan absolut
Kriteria kestabilan absolutKriteria kestabilan absolut
Kriteria kestabilan absolut
soeryaa
 
Recycling of oil
Recycling of oilRecycling of oil
Recycling of oil
juliathomas182
 
Pengaruh nonlinier pada gejala transien
Pengaruh nonlinier pada gejala transienPengaruh nonlinier pada gejala transien
Pengaruh nonlinier pada gejala transien
soeryaa
 
Information Systems from Designers’ Perspective
Information Systems from Designers’ PerspectiveInformation Systems from Designers’ Perspective
Information Systems from Designers’ PerspectiveMuhammad Ikhwan Jambak
 
Instantly prom
Instantly promInstantly prom
Instantly prom
soeryaa
 

Viewers also liked (20)

1st birthday baby gifts
1st birthday baby gifts1st birthday baby gifts
1st birthday baby gifts
 
Artile plan
Artile planArtile plan
Artile plan
 
Fp me reporte 2 aplicación.lucy suarez. actividad 2
Fp me reporte 2  aplicación.lucy suarez. actividad 2Fp me reporte 2  aplicación.lucy suarez. actividad 2
Fp me reporte 2 aplicación.lucy suarez. actividad 2
 
Modulator dan demodulator
Modulator dan demodulatorModulator dan demodulator
Modulator dan demodulator
 
Kestabilan absolut
Kestabilan absolutKestabilan absolut
Kestabilan absolut
 
Lyapunov
LyapunovLyapunov
Lyapunov
 
Pencapaian unit rt n srs 2015 kursus ert
Pencapaian unit rt n srs 2015 kursus ertPencapaian unit rt n srs 2015 kursus ert
Pencapaian unit rt n srs 2015 kursus ert
 
Program residen
Program residenProgram residen
Program residen
 
Program residen
Program residenProgram residen
Program residen
 
Vectores
VectoresVectores
Vectores
 
Protocolo reporte actividad 4 de aplicación aamtic abril20
Protocolo reporte  actividad 4 de aplicación aamtic abril20Protocolo reporte  actividad 4 de aplicación aamtic abril20
Protocolo reporte actividad 4 de aplicación aamtic abril20
 
Gomeralcontin windows 7 installation
Gomeralcontin windows 7 installationGomeralcontin windows 7 installation
Gomeralcontin windows 7 installation
 
Ionic app
Ionic appIonic app
Ionic app
 
Proses dan jenis interupsi
Proses dan jenis interupsiProses dan jenis interupsi
Proses dan jenis interupsi
 
Keyboard
KeyboardKeyboard
Keyboard
 
Kriteria kestabilan absolut
Kriteria kestabilan absolutKriteria kestabilan absolut
Kriteria kestabilan absolut
 
Recycling of oil
Recycling of oilRecycling of oil
Recycling of oil
 
Pengaruh nonlinier pada gejala transien
Pengaruh nonlinier pada gejala transienPengaruh nonlinier pada gejala transien
Pengaruh nonlinier pada gejala transien
 
Information Systems from Designers’ Perspective
Information Systems from Designers’ PerspectiveInformation Systems from Designers’ Perspective
Information Systems from Designers’ Perspective
 
Instantly prom
Instantly promInstantly prom
Instantly prom
 

Similar to Write a program to perform translation

In C Programming create a program that converts a number from decimal.docx
In C Programming create a program that converts a number from decimal.docxIn C Programming create a program that converts a number from decimal.docx
In C Programming create a program that converts a number from decimal.docx
tristans3
 
Programming fundamentals
Programming fundamentalsProgramming fundamentals
Programming fundamentals
Zaibi Gondal
 
Computer graphics programs in c++
Computer graphics programs in c++Computer graphics programs in c++
Computer graphics programs in c++
Ankit Kumar
 
C Language Programs
C Language Programs C Language Programs
C Language Programs
Mansi Tyagi
 
C lab
C labC lab
Dam31303 dti2143 lab sheet 7
Dam31303 dti2143 lab sheet 7Dam31303 dti2143 lab sheet 7
Dam31303 dti2143 lab sheet 7alish sha
 
Best C Programming Solution
Best C Programming SolutionBest C Programming Solution
Best C Programming Solution
yogini sharma
 
Geometric and material nonlinearity analysis of 2 d truss with force and duct...
Geometric and material nonlinearity analysis of 2 d truss with force and duct...Geometric and material nonlinearity analysis of 2 d truss with force and duct...
Geometric and material nonlinearity analysis of 2 d truss with force and duct...
Salar Delavar Qashqai
 
C Programming
C ProgrammingC Programming
C Programming
Sumant Diwakar
 
Computer graphics
Computer graphicsComputer graphics
Computer graphicsamitsarda3
 
Computer graphics lab assignment
Computer graphics lab assignmentComputer graphics lab assignment
Computer graphics lab assignment
Abdullah Al Shiam
 
Numerical analysis
Numerical analysisNumerical analysis
Numerical analysisVishal Singh
 
C++ manual Report Full
C++ manual Report FullC++ manual Report Full
C++ manual Report Full
Thesis Scientist Private Limited
 
Common problems solving using c
Common problems solving using cCommon problems solving using c
Common problems solving using c
ArghodeepPaul
 
C file
C fileC file
Graphic Design Lab File.docx
Graphic Design Lab File.docxGraphic Design Lab File.docx
Graphic Design Lab File.docx
PayalJindal19
 
B.Com 1year Lab programs
B.Com 1year Lab programsB.Com 1year Lab programs
B.Com 1year Lab programs
Prasadu Peddi
 
Graphics practical lab manual
Graphics practical lab manualGraphics practical lab manual
Graphics practical lab manual
Vivek Kumar Sinha
 
C programs
C programsC programs
C programs
Vikram Nandini
 

Similar to Write a program to perform translation (20)

In C Programming create a program that converts a number from decimal.docx
In C Programming create a program that converts a number from decimal.docxIn C Programming create a program that converts a number from decimal.docx
In C Programming create a program that converts a number from decimal.docx
 
Programming fundamentals
Programming fundamentalsProgramming fundamentals
Programming fundamentals
 
Computer graphics programs in c++
Computer graphics programs in c++Computer graphics programs in c++
Computer graphics programs in c++
 
Progr3
Progr3Progr3
Progr3
 
C Language Programs
C Language Programs C Language Programs
C Language Programs
 
C lab
C labC lab
C lab
 
Dam31303 dti2143 lab sheet 7
Dam31303 dti2143 lab sheet 7Dam31303 dti2143 lab sheet 7
Dam31303 dti2143 lab sheet 7
 
Best C Programming Solution
Best C Programming SolutionBest C Programming Solution
Best C Programming Solution
 
Geometric and material nonlinearity analysis of 2 d truss with force and duct...
Geometric and material nonlinearity analysis of 2 d truss with force and duct...Geometric and material nonlinearity analysis of 2 d truss with force and duct...
Geometric and material nonlinearity analysis of 2 d truss with force and duct...
 
C Programming
C ProgrammingC Programming
C Programming
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
 
Computer graphics lab assignment
Computer graphics lab assignmentComputer graphics lab assignment
Computer graphics lab assignment
 
Numerical analysis
Numerical analysisNumerical analysis
Numerical analysis
 
C++ manual Report Full
C++ manual Report FullC++ manual Report Full
C++ manual Report Full
 
Common problems solving using c
Common problems solving using cCommon problems solving using c
Common problems solving using c
 
C file
C fileC file
C file
 
Graphic Design Lab File.docx
Graphic Design Lab File.docxGraphic Design Lab File.docx
Graphic Design Lab File.docx
 
B.Com 1year Lab programs
B.Com 1year Lab programsB.Com 1year Lab programs
B.Com 1year Lab programs
 
Graphics practical lab manual
Graphics practical lab manualGraphics practical lab manual
Graphics practical lab manual
 
C programs
C programsC programs
C programs
 

More from Shobhit Saxena

***भारत की जय जय कार ***
***भारत की जय जय कार *** ***भारत की जय जय कार ***
***भारत की जय जय कार ***
Shobhit Saxena
 
DFD For E-learning Project
DFD For E-learning ProjectDFD For E-learning Project
DFD For E-learning Project
Shobhit Saxena
 
Index page of lab file
Index page of lab fileIndex page of lab file
Index page of lab file
Shobhit Saxena
 
Write a program to perform Perspective projection
Write a program to perform Perspective projectionWrite a program to perform Perspective projection
Write a program to perform Perspective projection
Shobhit Saxena
 
Write a program to perform Oblique projection
Write a program to perform Oblique projectionWrite a program to perform Oblique projection
Write a program to perform Oblique projection
Shobhit Saxena
 
Write a program to perform Orthographic projection.
Write a program to perform Orthographic  projection.Write a program to perform Orthographic  projection.
Write a program to perform Orthographic projection.
Shobhit Saxena
 
Write a program to draw a cubic Bezier curve.
Write a program to draw a cubic Bezier curve. Write a program to draw a cubic Bezier curve.
Write a program to draw a cubic Bezier curve.
Shobhit Saxena
 
Graphics and Graphics Hardware System
Graphics and Graphics Hardware SystemGraphics and Graphics Hardware System
Graphics and Graphics Hardware System
Shobhit Saxena
 
Cover letter
Cover letterCover letter
Cover letter
Shobhit Saxena
 
WEEKLY PROGRESS REPORT (WPR) for DISSERTATION
WEEKLY PROGRESS REPORT (WPR) for DISSERTATIONWEEKLY PROGRESS REPORT (WPR) for DISSERTATION
WEEKLY PROGRESS REPORT (WPR) for DISSERTATION
Shobhit Saxena
 
Progress report for research paper
Progress report for research paperProgress report for research paper
Progress report for research paper
Shobhit Saxena
 
Opticalcharacter recognition
Opticalcharacter recognition Opticalcharacter recognition
Opticalcharacter recognition
Shobhit Saxena
 
Window to viewprt
Window to viewprtWindow to viewprt
Window to viewprt
Shobhit Saxena
 
Surface rendering
Surface renderingSurface rendering
Surface rendering
Shobhit Saxena
 
Community outreach portfolio shobhit
Community outreach portfolio shobhitCommunity outreach portfolio shobhit
Community outreach portfolio shobhit
Shobhit Saxena
 
Ch22 parallel d_bs_cs561
Ch22 parallel d_bs_cs561Ch22 parallel d_bs_cs561
Ch22 parallel d_bs_cs561
Shobhit Saxena
 
Shobhit portfolio
Shobhit portfolioShobhit portfolio
Shobhit portfolio
Shobhit Saxena
 

More from Shobhit Saxena (17)

***भारत की जय जय कार ***
***भारत की जय जय कार *** ***भारत की जय जय कार ***
***भारत की जय जय कार ***
 
DFD For E-learning Project
DFD For E-learning ProjectDFD For E-learning Project
DFD For E-learning Project
 
Index page of lab file
Index page of lab fileIndex page of lab file
Index page of lab file
 
Write a program to perform Perspective projection
Write a program to perform Perspective projectionWrite a program to perform Perspective projection
Write a program to perform Perspective projection
 
Write a program to perform Oblique projection
Write a program to perform Oblique projectionWrite a program to perform Oblique projection
Write a program to perform Oblique projection
 
Write a program to perform Orthographic projection.
Write a program to perform Orthographic  projection.Write a program to perform Orthographic  projection.
Write a program to perform Orthographic projection.
 
Write a program to draw a cubic Bezier curve.
Write a program to draw a cubic Bezier curve. Write a program to draw a cubic Bezier curve.
Write a program to draw a cubic Bezier curve.
 
Graphics and Graphics Hardware System
Graphics and Graphics Hardware SystemGraphics and Graphics Hardware System
Graphics and Graphics Hardware System
 
Cover letter
Cover letterCover letter
Cover letter
 
WEEKLY PROGRESS REPORT (WPR) for DISSERTATION
WEEKLY PROGRESS REPORT (WPR) for DISSERTATIONWEEKLY PROGRESS REPORT (WPR) for DISSERTATION
WEEKLY PROGRESS REPORT (WPR) for DISSERTATION
 
Progress report for research paper
Progress report for research paperProgress report for research paper
Progress report for research paper
 
Opticalcharacter recognition
Opticalcharacter recognition Opticalcharacter recognition
Opticalcharacter recognition
 
Window to viewprt
Window to viewprtWindow to viewprt
Window to viewprt
 
Surface rendering
Surface renderingSurface rendering
Surface rendering
 
Community outreach portfolio shobhit
Community outreach portfolio shobhitCommunity outreach portfolio shobhit
Community outreach portfolio shobhit
 
Ch22 parallel d_bs_cs561
Ch22 parallel d_bs_cs561Ch22 parallel d_bs_cs561
Ch22 parallel d_bs_cs561
 
Shobhit portfolio
Shobhit portfolioShobhit portfolio
Shobhit portfolio
 

Recently uploaded

1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
EduSkills OECD
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
AzmatAli747758
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
PedroFerreira53928
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
Steve Thomason
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
bennyroshan06
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
Vivekanand Anglo Vedic Academy
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
Nguyen Thanh Tu Collection
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
PedroFerreira53928
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 

Recently uploaded (20)

1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 

Write a program to perform translation

  • 1. EXPERIMENT Objective: - Write a program to perform translation. Software Used: - Turbo c Theory: - To translate an object by a vector v, each homogeneous vector p (written in homogeneous coordinates) would need to be multiplied by thistranslation matrix: As shown below, the multiplication will give the expected result: Program : #include <stdio.h> #include <stdlib.h> #include<graphics.h> #include<conio.h> #include<math.h> void draw2d(int,int [],int [],int,int); void main() { int gd=DETECT, gm; int x[20],y[20],tx=0,ty=0,i,fs; initgraph(&gd,&gm," C:TURBOC3BIN"); printf("No of edges : "); scanf("%d",&fs);
  • 2. printf("Co-ordinates : "); for(i=0;i<fs;i++) { printf("(x%d,y%d)",i,i); scanf("%d%d",&x[i],&y[i]); } draw2d(fs,x,y,tx,ty); printf("translation (x,y) : "); scanf("%d%d",&tx,&ty); draw2d(fs,x,y,tx,ty); getch(); } void draw2d(int fs,int x[20],int y[20],int tx,int ty) { int i; for(i=0;i<fs;i++) { if(i!=(fs-1)) line(x[i]+tx,y[i]+ty,x[i+1]+tx,y[i+1]+ty); else line(x[i]+tx,y[i]+ty,x[0]+tx,y[0]+ty); } }