SlideShare a Scribd company logo
1 of 4
EXPERIMENT- 2
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

Simpleks minimasi
Simpleks minimasiSimpleks minimasi
Simpleks minimasiviaigii
 
titik buhul dan cremona
titik buhul dan cremonatitik buhul dan cremona
titik buhul dan cremonaWahh Yudi
 
makalah menejemen konstruksi proyek
makalah menejemen konstruksi proyekmakalah menejemen konstruksi proyek
makalah menejemen konstruksi proyekrenol abadi
 
Bab 7. pengujian_hipotesa1
Bab 7. pengujian_hipotesa1Bab 7. pengujian_hipotesa1
Bab 7. pengujian_hipotesa1andrewpratama
 
Fisika Dasar Ardi Mawardi
Fisika Dasar Ardi MawardiFisika Dasar Ardi Mawardi
Fisika Dasar Ardi Mawardifirdayanti8
 
Tabel kontingensi 2x2 dan uji independensi
Tabel kontingensi 2x2 dan uji independensiTabel kontingensi 2x2 dan uji independensi
Tabel kontingensi 2x2 dan uji independensiDarnah Andi Nohe
 
Bab v persamaan-diferensial-parsial
Bab v persamaan-diferensial-parsialBab v persamaan-diferensial-parsial
Bab v persamaan-diferensial-parsialfekissombolayuk
 
Kumpulan soal-latihan-andat-statdas-biostat-2011
Kumpulan soal-latihan-andat-statdas-biostat-2011Kumpulan soal-latihan-andat-statdas-biostat-2011
Kumpulan soal-latihan-andat-statdas-biostat-2011Heri Setiawan
 
Polinomial (1)
Polinomial (1)Polinomial (1)
Polinomial (1)annisadera
 
Variants of Turing Machine
Variants of Turing MachineVariants of Turing Machine
Variants of Turing MachineRajendran
 

What's hot (20)

Simpleks minimasi
Simpleks minimasiSimpleks minimasi
Simpleks minimasi
 
tg_p3.pptx
tg_p3.pptxtg_p3.pptx
tg_p3.pptx
 
Mekanika tanah bab 6
Mekanika tanah bab 6Mekanika tanah bab 6
Mekanika tanah bab 6
 
PPT M4 KB1
PPT M4 KB1PPT M4 KB1
PPT M4 KB1
 
titik buhul dan cremona
titik buhul dan cremonatitik buhul dan cremona
titik buhul dan cremona
 
makalah menejemen konstruksi proyek
makalah menejemen konstruksi proyekmakalah menejemen konstruksi proyek
makalah menejemen konstruksi proyek
 
PENDUGAAN PARAMETER
PENDUGAAN PARAMETERPENDUGAAN PARAMETER
PENDUGAAN PARAMETER
 
Bab 7. pengujian_hipotesa1
Bab 7. pengujian_hipotesa1Bab 7. pengujian_hipotesa1
Bab 7. pengujian_hipotesa1
 
Tugas matdisk
Tugas matdiskTugas matdisk
Tugas matdisk
 
Fisika Dasar Ardi Mawardi
Fisika Dasar Ardi MawardiFisika Dasar Ardi Mawardi
Fisika Dasar Ardi Mawardi
 
Tabel kontingensi 2x2 dan uji independensi
Tabel kontingensi 2x2 dan uji independensiTabel kontingensi 2x2 dan uji independensi
Tabel kontingensi 2x2 dan uji independensi
 
Bab v persamaan-diferensial-parsial
Bab v persamaan-diferensial-parsialBab v persamaan-diferensial-parsial
Bab v persamaan-diferensial-parsial
 
Transformasi box-cox
Transformasi box-coxTransformasi box-cox
Transformasi box-cox
 
Distribusi sampling
Distribusi samplingDistribusi sampling
Distribusi sampling
 
Deret fourier
Deret fourierDeret fourier
Deret fourier
 
Bab i jalan raya
Bab i jalan rayaBab i jalan raya
Bab i jalan raya
 
4 probabilitas ptik
4 probabilitas ptik4 probabilitas ptik
4 probabilitas ptik
 
Kumpulan soal-latihan-andat-statdas-biostat-2011
Kumpulan soal-latihan-andat-statdas-biostat-2011Kumpulan soal-latihan-andat-statdas-biostat-2011
Kumpulan soal-latihan-andat-statdas-biostat-2011
 
Polinomial (1)
Polinomial (1)Polinomial (1)
Polinomial (1)
 
Variants of Turing Machine
Variants of Turing MachineVariants of Turing Machine
Variants of Turing Machine
 

Viewers also liked

Tecnologia aplicada a la educacion tarea 4
Tecnologia aplicada a la educacion tarea 4Tecnologia aplicada a la educacion tarea 4
Tecnologia aplicada a la educacion tarea 4Luz Divina Suarez Rojas
 
Graphics and Graphics Hardware System
Graphics and Graphics Hardware SystemGraphics and Graphics Hardware System
Graphics and Graphics Hardware SystemShobhit Saxena
 
1174 p1-p psp-teknik audio video
1174 p1-p psp-teknik audio video1174 p1-p psp-teknik audio video
1174 p1-p psp-teknik audio videoEko Supriyadi
 
1174 p1-spk-teknik audio video
1174 p1-spk-teknik audio video1174 p1-spk-teknik audio video
1174 p1-spk-teknik audio videoEko Supriyadi
 
1174 p1-in v-teknik audio video
1174 p1-in v-teknik audio video1174 p1-in v-teknik audio video
1174 p1-in v-teknik audio videoEko Supriyadi
 
Wiki Loves Monuments 2016: Winners
Wiki Loves Monuments 2016: WinnersWiki Loves Monuments 2016: Winners
Wiki Loves Monuments 2016: Winnersmaditabalnco
 
HTML5 Web アプリケーションのセキュリティ
HTML5 Web アプリケーションのセキュリティHTML5 Web アプリケーションのセキュリティ
HTML5 Web アプリケーションのセキュリティ彰 村地
 
1174 p2-in v-teknik audio video
1174 p2-in v-teknik audio video1174 p2-in v-teknik audio video
1174 p2-in v-teknik audio videoEko Supriyadi
 
Icse class 7th surface area and volume
Icse class 7th surface area and volumeIcse class 7th surface area and volume
Icse class 7th surface area and volumePavan Kumar
 

Viewers also liked (12)

Tecnologia aplicada a la educacion tarea 4
Tecnologia aplicada a la educacion tarea 4Tecnologia aplicada a la educacion tarea 4
Tecnologia aplicada a la educacion tarea 4
 
Graphics and Graphics Hardware System
Graphics and Graphics Hardware SystemGraphics and Graphics Hardware System
Graphics and Graphics Hardware System
 
School solution
School solutionSchool solution
School solution
 
1174 p1-p psp-teknik audio video
1174 p1-p psp-teknik audio video1174 p1-p psp-teknik audio video
1174 p1-p psp-teknik audio video
 
1174 p1-spk-teknik audio video
1174 p1-spk-teknik audio video1174 p1-spk-teknik audio video
1174 p1-spk-teknik audio video
 
1174 p1-in v-teknik audio video
1174 p1-in v-teknik audio video1174 p1-in v-teknik audio video
1174 p1-in v-teknik audio video
 
Wiki Loves Monuments 2016: Winners
Wiki Loves Monuments 2016: WinnersWiki Loves Monuments 2016: Winners
Wiki Loves Monuments 2016: Winners
 
HTML5 Web アプリケーションのセキュリティ
HTML5 Web アプリケーションのセキュリティHTML5 Web アプリケーションのセキュリティ
HTML5 Web アプリケーションのセキュリティ
 
Motor vehiclesrule 1
Motor vehiclesrule 1Motor vehiclesrule 1
Motor vehiclesrule 1
 
1174 p2-in v-teknik audio video
1174 p2-in v-teknik audio video1174 p2-in v-teknik audio video
1174 p2-in v-teknik audio video
 
Icse class 7th surface area and volume
Icse class 7th surface area and volumeIcse class 7th surface area and volume
Icse class 7th surface area and volume
 
Drug abuse
Drug abuse Drug abuse
Drug abuse
 

Similar to Write a program to perform translation.

Write a program to perform translation
Write a program to perform translationWrite a program to perform translation
Write a program to perform translationShobhit Saxena
 
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.docxtristans3
 
Programming fundamentals
Programming fundamentalsProgramming fundamentals
Programming fundamentalsZaibi Gondal
 
Computer graphics programs in c++
Computer graphics programs in c++Computer graphics programs in c++
Computer graphics programs in c++Ankit Kumar
 
C programs Set 2
C programs Set 2C programs Set 2
C programs Set 2Koshy Geoji
 
Dam31303 dti2143 lab sheet 7
Dam31303 dti2143 lab sheet 7Dam31303 dti2143 lab sheet 7
Dam31303 dti2143 lab sheet 7alish sha
 
Bti1022 lab sheet 9 10
Bti1022 lab sheet 9 10Bti1022 lab sheet 9 10
Bti1022 lab sheet 9 10alish sha
 
Computer graphics
Computer graphicsComputer graphics
Computer graphicsamitsarda3
 
C Language Programs
C Language Programs C Language Programs
C Language Programs Mansi Tyagi
 
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
 
Best C Programming Solution
Best C Programming SolutionBest C Programming Solution
Best C Programming Solutionyogini sharma
 
Computer graphics lab assignment
Computer graphics lab assignmentComputer graphics lab assignment
Computer graphics lab assignmentAbdullah Al Shiam
 
Graphic Design Lab File.docx
Graphic Design Lab File.docxGraphic Design Lab File.docx
Graphic Design Lab File.docxPayalJindal19
 

Similar to Write a program to perform translation. (20)

Write a program to perform translation
Write a program to perform translationWrite a program to perform translation
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
 
Programming fundamentals
Programming fundamentalsProgramming fundamentals
Programming fundamentals
 
C Programming Example
C Programming Example C Programming Example
C Programming Example
 
Computer graphics programs in c++
Computer graphics programs in c++Computer graphics programs in c++
Computer graphics programs in c++
 
Progr3
Progr3Progr3
Progr3
 
C programs Set 2
C programs Set 2C programs Set 2
C programs Set 2
 
Dam31303 dti2143 lab sheet 7
Dam31303 dti2143 lab sheet 7Dam31303 dti2143 lab sheet 7
Dam31303 dti2143 lab sheet 7
 
Bti1022 lab sheet 9 10
Bti1022 lab sheet 9 10Bti1022 lab sheet 9 10
Bti1022 lab sheet 9 10
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
 
C Language Programs
C Language Programs C Language Programs
C Language Programs
 
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 lab
C labC lab
C lab
 
C Programming Example
C Programming ExampleC Programming Example
C Programming Example
 
C++ manual Report Full
C++ manual Report FullC++ manual Report Full
C++ manual Report Full
 
C Programming
C ProgrammingC Programming
C Programming
 
Best C Programming Solution
Best C Programming SolutionBest C Programming Solution
Best C Programming Solution
 
Computer graphics lab assignment
Computer graphics lab assignmentComputer graphics lab assignment
Computer graphics lab assignment
 
Graphic Design Lab File.docx
Graphic Design Lab File.docxGraphic Design Lab File.docx
Graphic Design Lab File.docx
 
Linux_C_LabBasics.ppt
Linux_C_LabBasics.pptLinux_C_LabBasics.ppt
Linux_C_LabBasics.ppt
 

More from Shobhit Saxena

***भारत की जय जय कार ***
***भारत की जय जय कार *** ***भारत की जय जय कार ***
***भारत की जय जय कार *** Shobhit Saxena
 
DFD For E-learning Project
DFD For E-learning ProjectDFD For E-learning Project
DFD For E-learning ProjectShobhit Saxena
 
Index page of lab file
Index page of lab fileIndex page of lab file
Index page of lab fileShobhit 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 projectionShobhit 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 projectionShobhit 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
 
WEEKLY PROGRESS REPORT (WPR) for DISSERTATION
WEEKLY PROGRESS REPORT (WPR) for DISSERTATIONWEEKLY PROGRESS REPORT (WPR) for DISSERTATION
WEEKLY PROGRESS REPORT (WPR) for DISSERTATIONShobhit Saxena
 
Progress report for research paper
Progress report for research paperProgress report for research paper
Progress report for research paperShobhit Saxena
 
Opticalcharacter recognition
Opticalcharacter recognition Opticalcharacter recognition
Opticalcharacter recognition Shobhit Saxena
 
Community outreach portfolio shobhit
Community outreach portfolio shobhitCommunity outreach portfolio shobhit
Community outreach portfolio shobhitShobhit Saxena
 
Ch22 parallel d_bs_cs561
Ch22 parallel d_bs_cs561Ch22 parallel d_bs_cs561
Ch22 parallel d_bs_cs561Shobhit 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.
 
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
 
Ionic app
Ionic appIonic app
Ionic app
 
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

Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineeringmalavadedarshan25
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
microprocessor 8085 and its interfacing
microprocessor 8085  and its interfacingmicroprocessor 8085  and its interfacing
microprocessor 8085 and its interfacingjaychoudhary37
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and usesDevarapalliHaritha
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learningmisbanausheenparvam
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝soniya singh
 
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2RajaP95
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 

Recently uploaded (20)

Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineering
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
microprocessor 8085 and its interfacing
microprocessor 8085  and its interfacingmicroprocessor 8085  and its interfacing
microprocessor 8085 and its interfacing
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and uses
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learning
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
 
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 

Write a program to perform translation.

  • 1. EXPERIMENT- 2 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); } }