Professional Documents
Culture Documents
Wire-Frame Modeling: An Application of Bresenham's Line-Drawing Algorithm
Wire-Frame Modeling: An Application of Bresenham's Line-Drawing Algorithm
An application of Bresenham’s
line-drawing algorithm
3D models
• Simple objects from the world around us
can be depicted as “wire-frame models”
• We make a list of the “key” points (usually
corners) on the object’s outer surface and
a list of all the lines that connect them
• The “key” points are called “vertices”
• The connecting lines are called “edges”
• We create a file that contains this “data”
Example: the basic barn
10 corner-points (“vertices”)
15 line-segments (“edges”)
3D-coordinates
Front vertices Back vertices
V0=( 0.5, 0.5, 0.5 ) V1=( 0.5, 0.5, -0.5 )
V2=( 0.5, -0.5, 0.5 ) V3=( 0.5, -0.5, -0.5 )
V4=( -0.5, -0.5, 0.5 ) V5=( -0.5, -0.5, -0.5 )
V6=( -0.5, 0.5, 0.5 ) V7=( -0.5, 0.5, -0.5 )
V8=( 0.0, 1.0, 0.5 ) V9=( 0.0, 1.0, -0.5 )
Perspective Projection
• We imagine the computer display screen
is located between the wireframe model
and the eye of someone who’s viewing it
• Each vertex is “projected” onto the screen
• We use Bresenham’s algorithm to draw
line-segments that connect the projections
• A “demo program” will show this effect
The projection
Y-axis P(x,y,z)
P*(x*,y*,0)
X-axis
View-plane
Eye of viewer
(0,0,D)
Z-axis D = distance of eye from view-plane
Similar Triangles
Corresponding sides have proportional lengths
C
c A
a
b B
P*(x*,y*,0) y
y*
Eye
Z-axis
D z
View-plane
Projection: top-view
D z
Z-axis
x*
x
x* = x / ( 1 – z / D )
y* = y / ( 1 – z / D )