A package or library that links to a language or

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: tute of Information Technology - Allahabad Graphics Libraries and packages • What is a graphics system? • A package or Library that links to a Language or environment and lets us write programs that are independent of the graphics hardware and devices • Java Development Kit and Java 2D and Java 3D libraries • GL and OpenGL (Graphics Library), VOGL • X11, DirectX, PHIGS,… and lots of others Indian Institute of Information Technology - Allahabad Summary • Graphics has a varied history • Note devices and memory model • Very technology driven • Colour models and drawing spaces are important ideas for our programs • Good advances in recent years with adequate memory and processing power • Primitives and library layers approach is very common Indian Institute of Information Technology - Allahabad Towards the Ideal Line • We can only do a discrete approximation • Illuminate pixels as close to the true path as possible, consider bi-level display only – Pixels are either lit or not lit What is an ideal line • Must appear straight and continuous – Only possible axis-aligned and 45o lines • Must interpolate both defining end points • Must have uniform density and intensity – Consistent within a line and over all lines – What about antialiasing? • Must be efficient, drawn quickly – Lots of them are required!!! Indian Institute of Information Technology - Allahabad Simple Line Based on slope-intercept algorithm from algebra: y = mx + b Simple approach: increment x, solve for y Floating point arithmetic required Indian Institute of Information Technology - Allahabad LINE-DRAWING ALGORITHMS Indian Institute of Information Technology - Allahabad Does it Work? It seems to work okay for lines with a slope of 1 or less, but doesn’t work well for lines with slope greater than 1 – lines become more discontinuous in appearance and we must add more than 1 pixel per column to make it work. Solution? - use symmetry. Indian Institute of Information Technology - Allahabad Modify algorithm per octant OR, increment along x-axis if dy<dx else increment along y-axis DDA algorithm • DDA = Digital Differential Analyser – finite differences • Treat line as parametric equation in t : Start point End point - ( x1 , y1 ) ( x2 , y 2 ) x(t ) = x1 + t ( x2 − x1 ) y (t ) = y1 + t ( y2 − y1 ) Indian Institute of Info...
View Full Document

This document was uploaded on 04/07/2014.

Ask a homework question - tutors are online