Lecture05 - Output Primitives (Part I)

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

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

Output Primitives Output Primitives Part I Line-Drawing Algorithms

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

View Full Document
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.
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)

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

View Full Document
Line Line
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

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

View Full Document
Line-Drawing Algorithms Line-Drawing Algorithms Digital Differential Analyzer (DDA) Algorithm Bresenham’s Line Algorithm
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 =

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

View Full Document
DDA Algorithm (cont.)
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
Ask a homework question - tutors are online