SlideShare a Scribd company logo
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

Hidden lines & surfaces
Hidden lines & surfacesHidden lines & surfaces
Hidden lines & surfaces
Ankur Kumar
 
Projection In Computer Graphics
Projection In Computer GraphicsProjection In Computer Graphics
Projection In Computer Graphics
Sanu Philip
 
Computer graphics curves and surfaces (1)
Computer graphics curves and surfaces (1)Computer graphics curves and surfaces (1)
Computer graphics curves and surfaces (1)
RohitK71
 
Quadric surfaces
Quadric surfacesQuadric surfaces
Quadric surfaces
Ankur Kumar
 
Polygon Fill
Polygon FillPolygon Fill
Polygon Fill
wahab13
 
2 d geometric transformations
2 d geometric transformations2 d geometric transformations
2 d geometric transformations
Mohd Arif
 
Graphics software standards
Graphics software standardsGraphics software standards
Graphics software standards
Ankit Garg
 
Reflection transformation
Reflection transformationReflection transformation
Reflection transformation
Mani Kanth
 
Window to Viewport Transformation in Computer Graphics with.pptx
Window to Viewport Transformation in Computer Graphics with.pptxWindow to Viewport Transformation in Computer Graphics with.pptx
Window to Viewport Transformation in Computer Graphics with.pptx
Dolchandra
 
CG - Output Primitives
CG - Output PrimitivesCG - Output Primitives
CG - Output Primitives
vinay arora
 
Computer Graphics (Hidden surfaces and line removal, Curves and surfaces, Sur...
Computer Graphics (Hidden surfaces and line removal, Curves and surfaces, Sur...Computer Graphics (Hidden surfaces and line removal, Curves and surfaces, Sur...
Computer Graphics (Hidden surfaces and line removal, Curves and surfaces, Sur...
rohitjasudkar
 
2D Transformation
2D Transformation2D Transformation
2D Transformation
ShahDhruv21
 
Spline representations
Spline representationsSpline representations
Spline representations
Nikhil krishnan
 
Projection In Computer Graphics
Projection In Computer GraphicsProjection In Computer Graphics
Projection In Computer Graphics
Sanu Philip
 
3 d viewing projection
3 d viewing  projection3 d viewing  projection
3 d viewing projection
Pooja Dixit
 
Liang- Barsky Algorithm, Polygon clipping & pipeline clipping of polygons
Liang- Barsky Algorithm, Polygon clipping & pipeline clipping of polygonsLiang- Barsky Algorithm, Polygon clipping & pipeline clipping of polygons
Liang- Barsky Algorithm, Polygon clipping & pipeline clipping of polygons
Lahiru Danushka
 
COMPUTER GRAPHICS-"Projection"
COMPUTER GRAPHICS-"Projection"COMPUTER GRAPHICS-"Projection"
COMPUTER GRAPHICS-"Projection"
Ankit Surti
 
Fill area algorithms
Fill area algorithmsFill area algorithms
Fill area algorithms
Kumar
 
Unit 3
Unit 3Unit 3
Unit 3
ypnrao
 
CS 354 More Graphics Pipeline
CS 354 More Graphics PipelineCS 354 More Graphics Pipeline
CS 354 More Graphics Pipeline
Mark Kilgard
 

What's hot (20)

Hidden lines & surfaces
Hidden lines & surfacesHidden lines & surfaces
Hidden lines & surfaces
 
Projection In Computer Graphics
Projection In Computer GraphicsProjection In Computer Graphics
Projection In Computer Graphics
 
Computer graphics curves and surfaces (1)
Computer graphics curves and surfaces (1)Computer graphics curves and surfaces (1)
Computer graphics curves and surfaces (1)
 
Quadric surfaces
Quadric surfacesQuadric surfaces
Quadric surfaces
 
Polygon Fill
Polygon FillPolygon Fill
Polygon Fill
 
2 d geometric transformations
2 d geometric transformations2 d geometric transformations
2 d geometric transformations
 
Graphics software standards
Graphics software standardsGraphics software standards
Graphics software standards
 
Reflection transformation
Reflection transformationReflection transformation
Reflection transformation
 
Window to Viewport Transformation in Computer Graphics with.pptx
Window to Viewport Transformation in Computer Graphics with.pptxWindow to Viewport Transformation in Computer Graphics with.pptx
Window to Viewport Transformation in Computer Graphics with.pptx
 
CG - Output Primitives
CG - Output PrimitivesCG - Output Primitives
CG - Output Primitives
 
Computer Graphics (Hidden surfaces and line removal, Curves and surfaces, Sur...
Computer Graphics (Hidden surfaces and line removal, Curves and surfaces, Sur...Computer Graphics (Hidden surfaces and line removal, Curves and surfaces, Sur...
Computer Graphics (Hidden surfaces and line removal, Curves and surfaces, Sur...
 
2D Transformation
2D Transformation2D Transformation
2D Transformation
 
Spline representations
Spline representationsSpline representations
Spline representations
 
Projection In Computer Graphics
Projection In Computer GraphicsProjection In Computer Graphics
Projection In Computer Graphics
 
3 d viewing projection
3 d viewing  projection3 d viewing  projection
3 d viewing projection
 
Liang- Barsky Algorithm, Polygon clipping & pipeline clipping of polygons
Liang- Barsky Algorithm, Polygon clipping & pipeline clipping of polygonsLiang- Barsky Algorithm, Polygon clipping & pipeline clipping of polygons
Liang- Barsky Algorithm, Polygon clipping & pipeline clipping of polygons
 
COMPUTER GRAPHICS-"Projection"
COMPUTER GRAPHICS-"Projection"COMPUTER GRAPHICS-"Projection"
COMPUTER GRAPHICS-"Projection"
 
Fill area algorithms
Fill area algorithmsFill area algorithms
Fill area algorithms
 
Unit 3
Unit 3Unit 3
Unit 3
 
CS 354 More Graphics Pipeline
CS 354 More Graphics PipelineCS 354 More Graphics Pipeline
CS 354 More Graphics Pipeline
 

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 DISSERTATION
Shobhit Saxena
 
Eyf webinar sepa career fair 2010
Eyf webinar sepa career fair 2010Eyf webinar sepa career fair 2010
Eyf webinar sepa career fair 2010
elliecantor
 
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 envejecimiento
Carlota 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
 
Defusión cognitiva
Defusión cognitivaDefusión cognitiva
Defusión cognitiva
Julie Carolina Espitia Posada
 
What is an mlm company?
What is an mlm company?What is an mlm company?
What is an mlm company?
JoAnne Mbonigaba
 
Юлия Бондарчук "Инструменты продвижения для клиентов 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 lights
Krishnan D G
 
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 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 projection
Shobhit 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 Graphics
Abdullah Khan
 
Introduction_computer_graphics_unit-1.pptx
Introduction_computer_graphics_unit-1.pptxIntroduction_computer_graphics_unit-1.pptx
Introduction_computer_graphics_unit-1.pptx
shivanipuran1
 
introduction to graphics unit 1 image processing
introduction to graphics unit 1 image processingintroduction to graphics unit 1 image processing
introduction to graphics unit 1 image processing
shivani5543
 
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
Schuyler Kennedy
 
Cg
CgCg
CG_1.pdf
CG_1.pdfCG_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
bcanawakadalcollege
 
Computer graphics notes
Computer graphics notesComputer graphics notes
Computer graphics notes
smruti sarangi
 
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...
Daroko blog(www.professionalbloggertricks.com)
 
Task 2
Task 2Task 2
introduction to computer graphics unit 1
introduction to computer graphics unit 1introduction to computer graphics unit 1
introduction to computer graphics unit 1
shivani5543
 
Digital design
Digital designDigital design
Digital design
Sheetu Goel
 
Computer Graphics Practical
Computer Graphics PracticalComputer Graphics Practical
Computer Graphics Practical
Neha 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 animation
Rexeh1245
 
COMPUTER GRAPHICS DAY1
COMPUTER GRAPHICS DAY1COMPUTER GRAPHICS DAY1
COMPUTER GRAPHICS DAY1
Barnali Gupta Banik
 
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
Yu You
 
Bl32821831
Bl32821831Bl32821831
Bl32821831
IJMER
 
Nicolae_Denut_Theses
Nicolae_Denut_ThesesNicolae_Denut_Theses
Nicolae_Denut_Theses
Nicolae 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_presentation
Anish Patel
 
Graphics file
Graphics fileGraphics file
Graphics file
shweta-sharma99
 

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
 
introduction to graphics unit 1 image processing
introduction to graphics unit 1 image processingintroduction to graphics unit 1 image processing
introduction to graphics unit 1 image processing
 
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
 
introduction to computer graphics unit 1
introduction to computer graphics unit 1introduction to computer graphics unit 1
introduction to computer graphics unit 1
 
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
 
COMPUTER GRAPHICS DAY1
COMPUTER GRAPHICS DAY1COMPUTER GRAPHICS DAY1
COMPUTER GRAPHICS DAY1
 
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
 

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
 
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 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 System
Shobhit Saxena
 
Cover letter
Cover letterCover letter
Cover letter
Shobhit Saxena
 
Progress report for research paper
Progress report for research paperProgress report for research paper
Progress report for research paper
Shobhit Saxena
 
Ionic app
Ionic appIonic app
Ionic app
Shobhit Saxena
 
Write a program to perform translation
Write a program to perform translationWrite a program to perform translation
Write a program to perform translation
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 (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

Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
SUTEJAS
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
IJECEIAES
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
MDSABBIROJJAMANPAYEL
 
Heat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation pptHeat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation ppt
mamunhossenbd75
 
Engine Lubrication performance System.pdf
Engine Lubrication performance System.pdfEngine Lubrication performance System.pdf
Engine Lubrication performance System.pdf
mamamaam477
 
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODELDEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
gerogepatton
 
ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have oneISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
Las Vegas Warehouse
 
Manufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptxManufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptx
Madan Karki
 
Literature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptxLiterature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptx
Dr Ramhari Poudyal
 
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdfIron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
RadiNasr
 
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdfBPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
MIGUELANGEL966976
 
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
Yasser Mahgoub
 
Textile Chemical Processing and Dyeing.pdf
Textile Chemical Processing and Dyeing.pdfTextile Chemical Processing and Dyeing.pdf
Textile Chemical Processing and Dyeing.pdf
NazakatAliKhoso2
 
Engineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdfEngineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdf
abbyasa1014
 
132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
kandramariana6
 
basic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdfbasic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdf
NidhalKahouli2
 
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
171ticu
 
ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024
Rahul
 
Computational Engineering IITH Presentation
Computational Engineering IITH PresentationComputational Engineering IITH Presentation
Computational Engineering IITH Presentation
co23btech11018
 
Embedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoringEmbedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoring
IJECEIAES
 

Recently uploaded (20)

Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
 
Heat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation pptHeat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation ppt
 
Engine Lubrication performance System.pdf
Engine Lubrication performance System.pdfEngine Lubrication performance System.pdf
Engine Lubrication performance System.pdf
 
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODELDEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
 
ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have oneISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
 
Manufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptxManufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptx
 
Literature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptxLiterature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptx
 
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdfIron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
 
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdfBPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
 
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
 
Textile Chemical Processing and Dyeing.pdf
Textile Chemical Processing and Dyeing.pdfTextile Chemical Processing and Dyeing.pdf
Textile Chemical Processing and Dyeing.pdf
 
Engineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdfEngineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdf
 
132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
 
basic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdfbasic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdf
 
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
 
ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024
 
Computational Engineering IITH Presentation
Computational Engineering IITH PresentationComputational Engineering IITH Presentation
Computational Engineering IITH Presentation
 
Embedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoringEmbedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoring
 

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: