Lecture05 - Output Primitives (Part I)

Lecture05 Output - OutputPrimitives OutputPrimitives PartI OutputPrimitives OutputPrimitives Graphics output primitives Functions in a graphics

Info iconThis preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon
Output Primitives Output Primitives Part I Line-Drawing Algorithms
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Output Primitives Output Primitives Graphics output primitives Functions in a graphics package that we use to describe the various picture components. Geometric primitives Output primitives that describe the geometry of objects. Examples: point & line.
Background image of page 2
How do we draw a point? How do we draw a point? A point on the screen with position (x, y): plot a pixel with corresponding position. Sample code: SetPixel( x, y ) C/C++ glBegin(GL_POINTS) OpenGL glVertex2f(x, y) glEnd() (x, y) (x, y)
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Line Line
Background image of page 4
Slope-Intercept Equation Slope-Intercept Equation y = m*x + c ……. Eq. 1 dx = x 1 - x 0 dy = y 1 - y 0 m = dy / dx c = y 0 - m x 0 (x 0 ,y 0 ) (x 1 ,y 1 ) dy dx
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Line-Drawing Algorithms Line-Drawing Algorithms Digital Differential Analyzer (DDA) Algorithm Bresenham’s Line Algorithm
Background image of page 6
DDA Algorithm  DDA Algorithm  Based on Eq. 1 and positions of 2 endpoints (x1, y1), (x2, y2): Therefore, and x y x x y y m = - - = 1 2 1 2 x m y = m y x =
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
DDA Algorithm (cont.)
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/05/2010 for the course COMPUTER S 876 taught by Professor Ch during the Spring '10 term at Amirkabir University of Technology.

Page1 / 16

Lecture05 Output - OutputPrimitives OutputPrimitives PartI OutputPrimitives OutputPrimitives Graphics output primitives Functions in a graphics

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online