SlideShare a Scribd company logo
1 of 5
EXPERIMENT
Objective: - Write a program for window to viewport transformation
Software Used: - Turbo c
Theory: - A viewport is a polygon viewing region in computer graphics. In computer
graphics theory, there are two region-like notions of relevance when rendering some objects to
an image. In textbook terminology, the world coordinate window is the area of interest (meaning
what the user wants to visualize) in some application-specific coordinates, e.g. miles, centimeters
etc. In contrast, the viewport is an area (typically rectangular) expressed in rendering-device-
specific coordinates, e.g. pixels for screen coordinates, in which the objects of interest are going
to be rendered. Clipping to the world-coordinates window is usually applied to the objects before
they are passed through the window-to-viewport transformation. For a 2D object, the latter
transformation is simply a combination of translation and scaling, the latter not necessarily
uniform.[1] An analogy of this transformation process based on traditional photography notions is
to equate the world-clipping window with the camera settings and the variously sized prints that
can be obtained from the resulting film image as possible viewports.
Program :
#include"stdio.h"
#include"conio.h"
#include"graphics.h"
#include"stdlib.h"
void main()
{
float xwmin,xwmax,ywmax,ywmin;
float xvmin,xvmax,yvmax,yvmin;
float x[10],y[10],yv,xv,sx,sy;
int gd=DETECT,gm,i;
clrscr();
printf("n enter window port coordinates:n(xwmin,ywmin,xwmax,ywmax):");
scanf("%f%f%f%f",&xwmin,&ywmin,&xwmax,&ywmax);
printf("n enter view port coordinates:n(xvmin,yvmin,xvmax,yvmax):");
scanf("%f%f%f%f",&xvmin,&yvmin,&xvmax,&yvmax);
printf("n enter vertices for triangle:");
for(i=0;i < 3;i++)
{
printf("n enter(x%d,y%d):",i,i);
scanf("%f%f",&x[i],&y[i]);
}
sx=((xvmax-xvmin)/(xwmax-xwmin));
sy=((yvmax-yvmin)/(ywmax-xwmin));
initgraph(&gd,&gm,"");
outtextxy(80,30,"window port");
rectangle(xwmin,ywmin,xwmax,ywmax);
for(i=0;i <2;i++)
{
line(x[i],y[i],x[i+1],y[i+1]);
}
line(x[2],y[2],x[0],y[0]);
getch();
cleardevice();
for(i=0;i <3;i++)
{
x[i]=xvmin+((x[i]-xwmin)*sx);
y[i]=yvmin+((y[i]-ywmin)*sy);
}
outtextxy(150,10,"view port");
rectangle(xvmin,yvmin,xvmax,yvmax);
for(i=0;i <2;i++)
{
line(x[i],y[i],x[i+1],y[i+1]);
}
line(x[2],y[2],x[0],y[0]);
getch();
}
Output:
Window to viewprt
Window to viewprt
Window to viewprt

More Related Content

What's hot

Parallel and perspective projection in 3 d cg
Parallel and perspective projection in 3 d cgParallel and perspective projection in 3 d cg
Parallel and perspective projection in 3 d cgShaishavShah8
 
Reflection transformation
Reflection transformationReflection transformation
Reflection transformationMani Kanth
 
computer graphics
computer graphicscomputer graphics
computer graphicsashpri156
 
Introduction to computer graphics
Introduction to computer graphicsIntroduction to computer graphics
Introduction to computer graphicssonal_badhe
 
Polygon Mesh Representation
Polygon Mesh RepresentationPolygon Mesh Representation
Polygon Mesh RepresentationPirouz Nourian
 
Computer graphics(parametric cubic curves)
Computer graphics(parametric cubic curves)Computer graphics(parametric cubic curves)
Computer graphics(parametric cubic curves)Sinthia Sarker
 
Bezier and Spline Curves and Surfaces
Bezier and Spline Curves and SurfacesBezier and Spline Curves and Surfaces
Bezier and Spline Curves and SurfacesSyed Zaid Irshad
 
Random and raster scan
Random and raster scanRandom and raster scan
Random and raster scanankur bhalla
 
Image processing on matlab presentation
Image processing on matlab presentationImage processing on matlab presentation
Image processing on matlab presentationNaatchammai Ramanathan
 
Introduction to computer graphics
Introduction to computer graphicsIntroduction to computer graphics
Introduction to computer graphicsAmandeep Kaur
 
Graphics_3D viewing
Graphics_3D viewingGraphics_3D viewing
Graphics_3D viewingRabin BK
 
Model1 Active and Passive Graphics.pptx
Model1 Active and Passive Graphics.pptxModel1 Active and Passive Graphics.pptx
Model1 Active and Passive Graphics.pptxRahul Borate
 
Introduction to computer science
Introduction to computer scienceIntroduction to computer science
Introduction to computer scienceDarshan Gohel
 
Window to viewport transformation
Window to viewport transformationWindow to viewport transformation
Window to viewport transformationAnkit Garg
 
What's new in Shader Graph: ready for production – Unite Copenhagen 2019
What's new in Shader Graph: ready for production – Unite Copenhagen 2019What's new in Shader Graph: ready for production – Unite Copenhagen 2019
What's new in Shader Graph: ready for production – Unite Copenhagen 2019Unity Technologies
 
Output primitives in Computer Graphics
Output primitives in Computer GraphicsOutput primitives in Computer Graphics
Output primitives in Computer GraphicsKamal Acharya
 
Line Detection using Hough transform .pptx
Line Detection using Hough transform .pptxLine Detection using Hough transform .pptx
Line Detection using Hough transform .pptxshubham loni
 
Concept of basic illumination model
Concept of basic illumination modelConcept of basic illumination model
Concept of basic illumination modelAnkit Garg
 

What's hot (20)

Parallel and perspective projection in 3 d cg
Parallel and perspective projection in 3 d cgParallel and perspective projection in 3 d cg
Parallel and perspective projection in 3 d cg
 
Reflection transformation
Reflection transformationReflection transformation
Reflection transformation
 
computer graphics
computer graphicscomputer graphics
computer graphics
 
Introduction to computer graphics
Introduction to computer graphicsIntroduction to computer graphics
Introduction to computer graphics
 
Polygon Mesh Representation
Polygon Mesh RepresentationPolygon Mesh Representation
Polygon Mesh Representation
 
Polygon mesh
Polygon meshPolygon mesh
Polygon mesh
 
Computer graphics(parametric cubic curves)
Computer graphics(parametric cubic curves)Computer graphics(parametric cubic curves)
Computer graphics(parametric cubic curves)
 
Bezier and Spline Curves and Surfaces
Bezier and Spline Curves and SurfacesBezier and Spline Curves and Surfaces
Bezier and Spline Curves and Surfaces
 
Random and raster scan
Random and raster scanRandom and raster scan
Random and raster scan
 
Image processing on matlab presentation
Image processing on matlab presentationImage processing on matlab presentation
Image processing on matlab presentation
 
Introduction to computer graphics
Introduction to computer graphicsIntroduction to computer graphics
Introduction to computer graphics
 
Graphics_3D viewing
Graphics_3D viewingGraphics_3D viewing
Graphics_3D viewing
 
Model1 Active and Passive Graphics.pptx
Model1 Active and Passive Graphics.pptxModel1 Active and Passive Graphics.pptx
Model1 Active and Passive Graphics.pptx
 
Introduction to computer science
Introduction to computer scienceIntroduction to computer science
Introduction to computer science
 
Window to viewport transformation
Window to viewport transformationWindow to viewport transformation
Window to viewport transformation
 
What's new in Shader Graph: ready for production – Unite Copenhagen 2019
What's new in Shader Graph: ready for production – Unite Copenhagen 2019What's new in Shader Graph: ready for production – Unite Copenhagen 2019
What's new in Shader Graph: ready for production – Unite Copenhagen 2019
 
Output primitives in Computer Graphics
Output primitives in Computer GraphicsOutput primitives in Computer Graphics
Output primitives in Computer Graphics
 
Line Detection using Hough transform .pptx
Line Detection using Hough transform .pptxLine Detection using Hough transform .pptx
Line Detection using Hough transform .pptx
 
Computer vision
Computer visionComputer vision
Computer vision
 
Concept of basic illumination model
Concept of basic illumination modelConcept of basic illumination model
Concept of basic illumination model
 

Viewers also liked

Opticalcharacter recognition
Opticalcharacter recognition Opticalcharacter recognition
Opticalcharacter recognition 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
 
Eyf webinar sepa career fair 2010
Eyf webinar sepa career fair 2010Eyf webinar sepa career fair 2010
Eyf webinar sepa career fair 2010elliecantor
 
Is there anything wrong with genetically modified crops ?
Is there anything wrong with genetically modified crops?Is there anything wrong with genetically modified crops?
Is there anything wrong with genetically modified crops ?BHU,Varanasi
 
Изменения законодательства Российской Федерации – начало 2014 года
Изменения законодательства Российской Федерации – начало 2014 годаИзменения законодательства Российской Федерации – начало 2014 года
Изменения законодательства Российской Федерации – начало 2014 годаAccountor Russia and Ukraine
 
Guyana, Rice Industry, Payment Issues and Financial Transformation (2016)
Guyana, Rice Industry, Payment Issues and Financial Transformation (2016)Guyana, Rice Industry, Payment Issues and Financial Transformation (2016)
Guyana, Rice Industry, Payment Issues and Financial Transformation (2016)Lloyd Blenman PhD
 
Budgetory control in“ushodaya degree college.”.
Budgetory control in“ushodaya degree college.”.Budgetory control in“ushodaya degree college.”.
Budgetory control in“ushodaya degree college.”.saikrishnabachuwar
 
Юлия Бондарчук "Инструменты продвижения для клиентов Prom.ua"
Юлия Бондарчук "Инструменты продвижения для клиентов Prom.ua"Юлия Бондарчук "Инструменты продвижения для клиентов Prom.ua"
Юлия Бондарчук "Инструменты продвижения для клиентов Prom.ua"Prom
 
Caso clínico enfermería del envejecimiento
Caso clínico enfermería del envejecimientoCaso clínico enfermería del envejecimiento
Caso clínico enfermería del envejecimientoCarlota Salas
 
2014_04_msw_a4_format (2)
2014_04_msw_a4_format (2)2014_04_msw_a4_format (2)
2014_04_msw_a4_format (2)saransh kumar
 
Юлия Бондарчук "Инструменты продвижения для клиентов Prom.ua"
Юлия Бондарчук "Инструменты продвижения для клиентов Prom.ua"Юлия Бондарчук "Инструменты продвижения для клиентов Prom.ua"
Юлия Бондарчук "Инструменты продвижения для клиентов Prom.ua"Prom
 
Что нужно знать при открытии интернет-магазина, Олег Гродский
Что нужно знать при открытии интернет-магазина, Олег ГродскийЧто нужно знать при открытии интернет-магазина, Олег Гродский
Что нужно знать при открытии интернет-магазина, Олег ГродскийProm
 
Asira introduction to led lights
Asira introduction to led lightsAsira introduction to led lights
Asira introduction to led lightsKrishnan D G
 
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 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
 
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
 
Елена Радченко "Забота о покупателях на Bigl.ua"
Елена Радченко "Забота о покупателях на Bigl.ua"Елена Радченко "Забота о покупателях на Bigl.ua"
Елена Радченко "Забота о покупателях на Bigl.ua"Prom
 

Viewers also liked (20)

Opticalcharacter recognition
Opticalcharacter recognition Opticalcharacter recognition
Opticalcharacter recognition
 
WEEKLY PROGRESS REPORT (WPR) for DISSERTATION
WEEKLY PROGRESS REPORT (WPR) for DISSERTATIONWEEKLY PROGRESS REPORT (WPR) for DISSERTATION
WEEKLY PROGRESS REPORT (WPR) for DISSERTATION
 
Eyf webinar sepa career fair 2010
Eyf webinar sepa career fair 2010Eyf webinar sepa career fair 2010
Eyf webinar sepa career fair 2010
 
Is there anything wrong with genetically modified crops ?
Is there anything wrong with genetically modified crops?Is there anything wrong with genetically modified crops?
Is there anything wrong with genetically modified crops ?
 
Изменения законодательства Российской Федерации – начало 2014 года
Изменения законодательства Российской Федерации – начало 2014 годаИзменения законодательства Российской Федерации – начало 2014 года
Изменения законодательства Российской Федерации – начало 2014 года
 
Guyana, Rice Industry, Payment Issues and Financial Transformation (2016)
Guyana, Rice Industry, Payment Issues and Financial Transformation (2016)Guyana, Rice Industry, Payment Issues and Financial Transformation (2016)
Guyana, Rice Industry, Payment Issues and Financial Transformation (2016)
 
Budgetory control in“ushodaya degree college.”.
Budgetory control in“ushodaya degree college.”.Budgetory control in“ushodaya degree college.”.
Budgetory control in“ushodaya degree college.”.
 
Юлия Бондарчук "Инструменты продвижения для клиентов Prom.ua"
Юлия Бондарчук "Инструменты продвижения для клиентов Prom.ua"Юлия Бондарчук "Инструменты продвижения для клиентов Prom.ua"
Юлия Бондарчук "Инструменты продвижения для клиентов Prom.ua"
 
Caso clínico enfermería del envejecimiento
Caso clínico enfermería del envejecimientoCaso clínico enfermería del envejecimiento
Caso clínico enfermería del envejecimiento
 
2014_04_msw_a4_format (2)
2014_04_msw_a4_format (2)2014_04_msw_a4_format (2)
2014_04_msw_a4_format (2)
 
Defusión cognitiva
Defusión cognitivaDefusión cognitiva
Defusión cognitiva
 
What is an mlm company?
What is an mlm company?What is an mlm company?
What is an mlm company?
 
Юлия Бондарчук "Инструменты продвижения для клиентов Prom.ua"
Юлия Бондарчук "Инструменты продвижения для клиентов Prom.ua"Юлия Бондарчук "Инструменты продвижения для клиентов Prom.ua"
Юлия Бондарчук "Инструменты продвижения для клиентов Prom.ua"
 
Что нужно знать при открытии интернет-магазина, Олег Гродский
Что нужно знать при открытии интернет-магазина, Олег ГродскийЧто нужно знать при открытии интернет-магазина, Олег Гродский
Что нужно знать при открытии интернет-магазина, Олег Гродский
 
Asira introduction to led lights
Asira introduction to led lightsAsira introduction to led lights
Asira introduction to led lights
 
Index page of lab file
Index page of lab fileIndex page of lab file
Index page of lab file
 
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.
 
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
 
Елена Радченко "Забота о покупателях на Bigl.ua"
Елена Радченко "Забота о покупателях на Bigl.ua"Елена Радченко "Забота о покупателях на Bigl.ua"
Елена Радченко "Забота о покупателях на Bigl.ua"
 

Similar to Window to viewprt

Introduction to Computer Graphics
Introduction to Computer GraphicsIntroduction to Computer Graphics
Introduction to Computer GraphicsAbdullah Khan
 
Introduction_computer_graphics_unit-1.pptx
Introduction_computer_graphics_unit-1.pptxIntroduction_computer_graphics_unit-1.pptx
Introduction_computer_graphics_unit-1.pptxshivanipuran1
 
Computer-Vision_Integrating-Technology_MOB_17.06.16
Computer-Vision_Integrating-Technology_MOB_17.06.16Computer-Vision_Integrating-Technology_MOB_17.06.16
Computer-Vision_Integrating-Technology_MOB_17.06.16Schuyler Kennedy
 
Computer graphics notes
Computer graphics notesComputer graphics notes
Computer graphics notessmruti sarangi
 
Computer Graphics Practical
Computer Graphics PracticalComputer Graphics Practical
Computer Graphics PracticalNeha Sharma
 
Task 2 displaying 3 d polygon animation
Task 2 displaying 3 d polygon animationTask 2 displaying 3 d polygon animation
Task 2 displaying 3 d polygon animationRexeh1245
 
From 2D Map to Mobile 3D Mirror World
From 2D Map to Mobile 3D Mirror WorldFrom 2D Map to Mobile 3D Mirror World
From 2D Map to Mobile 3D Mirror WorldYu You
 
Bl32821831
Bl32821831Bl32821831
Bl32821831IJMER
 
Nicolae_Denut_Theses
Nicolae_Denut_ThesesNicolae_Denut_Theses
Nicolae_Denut_ThesesNicolae Denut
 
ANISH_and_DR.DANIEL_augmented_reality_presentation
ANISH_and_DR.DANIEL_augmented_reality_presentationANISH_and_DR.DANIEL_augmented_reality_presentation
ANISH_and_DR.DANIEL_augmented_reality_presentationAnish Patel
 
NGMAST 2012
NGMAST 2012NGMAST 2012
NGMAST 2012Yu You
 
Build Your Own 3D Scanner: 3D Scanning with Swept-Planes
Build Your Own 3D Scanner: 3D Scanning with Swept-PlanesBuild Your Own 3D Scanner: 3D Scanning with Swept-Planes
Build Your Own 3D Scanner: 3D Scanning with Swept-PlanesDouglas Lanman
 
CAD STANDARDS - SMART MANUFACTURING MECH
CAD STANDARDS - SMART MANUFACTURING MECHCAD STANDARDS - SMART MANUFACTURING MECH
CAD STANDARDS - SMART MANUFACTURING MECHRAJESHS631800
 

Similar to Window to viewprt (20)

Introduction to Computer Graphics
Introduction to Computer GraphicsIntroduction to Computer Graphics
Introduction to Computer Graphics
 
Introduction_computer_graphics_unit-1.pptx
Introduction_computer_graphics_unit-1.pptxIntroduction_computer_graphics_unit-1.pptx
Introduction_computer_graphics_unit-1.pptx
 
Computer-Vision_Integrating-Technology_MOB_17.06.16
Computer-Vision_Integrating-Technology_MOB_17.06.16Computer-Vision_Integrating-Technology_MOB_17.06.16
Computer-Vision_Integrating-Technology_MOB_17.06.16
 
Cg
CgCg
Cg
 
CG_1.pdf
CG_1.pdfCG_1.pdf
CG_1.pdf
 
computer graphics unit 1-I.pptx
computer graphics unit 1-I.pptxcomputer graphics unit 1-I.pptx
computer graphics unit 1-I.pptx
 
Computer graphics notes
Computer graphics notesComputer graphics notes
Computer graphics notes
 
Csc406 lecture7 device independence and normalization in Computer graphics(Co...
Csc406 lecture7 device independence and normalization in Computer graphics(Co...Csc406 lecture7 device independence and normalization in Computer graphics(Co...
Csc406 lecture7 device independence and normalization in Computer graphics(Co...
 
Task 2
Task 2Task 2
Task 2
 
Digital design
Digital designDigital design
Digital design
 
Computer Graphics Practical
Computer Graphics PracticalComputer Graphics Practical
Computer Graphics Practical
 
Task 2 displaying 3 d polygon animation
Task 2 displaying 3 d polygon animationTask 2 displaying 3 d polygon animation
Task 2 displaying 3 d polygon animation
 
From 2D Map to Mobile 3D Mirror World
From 2D Map to Mobile 3D Mirror WorldFrom 2D Map to Mobile 3D Mirror World
From 2D Map to Mobile 3D Mirror World
 
Bl32821831
Bl32821831Bl32821831
Bl32821831
 
Nicolae_Denut_Theses
Nicolae_Denut_ThesesNicolae_Denut_Theses
Nicolae_Denut_Theses
 
ANISH_and_DR.DANIEL_augmented_reality_presentation
ANISH_and_DR.DANIEL_augmented_reality_presentationANISH_and_DR.DANIEL_augmented_reality_presentation
ANISH_and_DR.DANIEL_augmented_reality_presentation
 
Graphics file
Graphics fileGraphics file
Graphics file
 
NGMAST 2012
NGMAST 2012NGMAST 2012
NGMAST 2012
 
Build Your Own 3D Scanner: 3D Scanning with Swept-Planes
Build Your Own 3D Scanner: 3D Scanning with Swept-PlanesBuild Your Own 3D Scanner: 3D Scanning with Swept-Planes
Build Your Own 3D Scanner: 3D Scanning with Swept-Planes
 
CAD STANDARDS - SMART MANUFACTURING MECH
CAD STANDARDS - SMART MANUFACTURING MECHCAD STANDARDS - SMART MANUFACTURING MECH
CAD STANDARDS - SMART MANUFACTURING MECH
 

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
 
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 translation.
 Write a program to perform translation. Write a program to perform translation.
Write a program to perform translation.Shobhit Saxena
 
Graphics and Graphics Hardware System
Graphics and Graphics Hardware SystemGraphics and Graphics Hardware System
Graphics and Graphics Hardware SystemShobhit Saxena
 
Progress report for research paper
Progress report for research paperProgress report for research paper
Progress report for research paperShobhit Saxena
 
Write a program to perform translation
Write a program to perform translationWrite a program to perform translation
Write a program to perform translationShobhit 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 (13)

***भारत की जय जय कार ***
***भारत की जय जय कार *** ***भारत की जय जय कार ***
***भारत की जय जय कार ***
 
DFD For E-learning Project
DFD For E-learning ProjectDFD For E-learning Project
DFD For E-learning Project
 
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 translation.
 Write a program to perform translation. Write a program to perform translation.
Write a program to perform translation.
 
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
 
Progress report for research paper
Progress report for research paperProgress report for research paper
Progress report for research paper
 
Ionic app
Ionic appIonic app
Ionic app
 
Write a program to perform translation
Write a program to perform translationWrite a program to perform translation
Write a program to perform translation
 
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

Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidNikhilNagaraju
 
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
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .Satyam Kumar
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineeringmalavadedarshan25
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxKartikeyaDwivedi3
 
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
 
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
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEroselinkalist12
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and usesDevarapalliHaritha
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxPoojaBan
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLDeelipZope
 
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
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...asadnawaz62
 

Recently uploaded (20)

Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfid
 
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
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineering
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptx
 
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...
 
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
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and uses
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptx
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
young call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Serviceyoung call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Service
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCL
 
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...
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...
 

Window to viewprt

  • 1. EXPERIMENT Objective: - Write a program for window to viewport transformation Software Used: - Turbo c Theory: - A viewport is a polygon viewing region in computer graphics. In computer graphics theory, there are two region-like notions of relevance when rendering some objects to an image. In textbook terminology, the world coordinate window is the area of interest (meaning what the user wants to visualize) in some application-specific coordinates, e.g. miles, centimeters etc. In contrast, the viewport is an area (typically rectangular) expressed in rendering-device- specific coordinates, e.g. pixels for screen coordinates, in which the objects of interest are going to be rendered. Clipping to the world-coordinates window is usually applied to the objects before they are passed through the window-to-viewport transformation. For a 2D object, the latter transformation is simply a combination of translation and scaling, the latter not necessarily uniform.[1] An analogy of this transformation process based on traditional photography notions is to equate the world-clipping window with the camera settings and the variously sized prints that can be obtained from the resulting film image as possible viewports. Program : #include"stdio.h" #include"conio.h" #include"graphics.h" #include"stdlib.h" void main() { float xwmin,xwmax,ywmax,ywmin; float xvmin,xvmax,yvmax,yvmin; float x[10],y[10],yv,xv,sx,sy; int gd=DETECT,gm,i; clrscr(); printf("n enter window port coordinates:n(xwmin,ywmin,xwmax,ywmax):"); scanf("%f%f%f%f",&xwmin,&ywmin,&xwmax,&ywmax); printf("n enter view port coordinates:n(xvmin,yvmin,xvmax,yvmax):"); scanf("%f%f%f%f",&xvmin,&yvmin,&xvmax,&yvmax); printf("n enter vertices for triangle:"); for(i=0;i < 3;i++) { printf("n enter(x%d,y%d):",i,i); scanf("%f%f",&x[i],&y[i]); } sx=((xvmax-xvmin)/(xwmax-xwmin));
  • 2. sy=((yvmax-yvmin)/(ywmax-xwmin)); initgraph(&gd,&gm,""); outtextxy(80,30,"window port"); rectangle(xwmin,ywmin,xwmax,ywmax); for(i=0;i <2;i++) { line(x[i],y[i],x[i+1],y[i+1]); } line(x[2],y[2],x[0],y[0]); getch(); cleardevice(); for(i=0;i <3;i++) { x[i]=xvmin+((x[i]-xwmin)*sx); y[i]=yvmin+((y[i]-ywmin)*sy); } outtextxy(150,10,"view port"); rectangle(xvmin,yvmin,xvmax,yvmax); for(i=0;i <2;i++) { line(x[i],y[i],x[i+1],y[i+1]); } line(x[2],y[2],x[0],y[0]); getch(); } Output: