plotting a line n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Plotting a Line PowerPoint Presentation
Download Presentation
Plotting a Line

Loading in 2 Seconds...

play fullscreen
1 / 10

Plotting a Line - PowerPoint PPT Presentation


  • 62 Views
  • Uploaded on

Plotting a Line. Discussion 11.5 Rev B 3/30/2006. plot(x,y,color). Example of the need for a stack. int orig_x, orig_y, endp_x, endp_y, midp_x, midp_y; if (orig_x > endp_x) then exchange orig and endp; push endp; push endp while (stack is not empty) // compute midp

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Plotting a Line' - glynn


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
plotting a line

Plotting a Line

Discussion 11.5

Rev B

3/30/2006

slide2

plot(x,y,color)

Example of the need for a stack

slide4

int orig_x, orig_y, endp_x, endp_y, midp_x, midp_y;

if(orig_x > endp_x)

then exchange orig and endp;

push endp;

push endp

while(stack is not empty)

// compute midp

midp_x = (orig_x + endp_x)/2;

if(endp_y < orig_y)

then midp_y = (orig_y + endp_y)/2 (rounded);

else midp_y = (orig_y + endp_y)/2;

if(midp = orig)

then

plot orig;

pop orig;

pop endp;

else

push endp;

push midp;

endp = midp;

end while;

slide6

int orig_x, orig_y, endp_x, endp_y, midp_x, midp_y;

if(orig_x > endp_x)

then exchange orig and endp;

push endp;

push endp

while(stack is not empty)

// compute midp

midp_x = (orig_x + endp_x)/2;

if(endp_y < orig_y)

then midp_y = (orig_y + endp_y)/2 (rounded);

else midp_y = (orig_y + endp_y)/2;

if(midp = orig)

then

plot orig;

pop orig;

pop endp;

else

push endp;

push midp;

endp = midp;

end while;

Datapath

slide7

>: if orig_x > orig_y then

xgtflg <= ‘1’ ;

else

xgtflg <= ‘0’ ;

end if;

=: if (orig_x = midp_x) and (orig_y = midp_y) then

eqflg <= ‘1’ ;

else

eqflg <= ‘0’ ;

end if;

slide8

+/2: tempx <= (orig_x + endp_x);

xmid <= ‘0’ & tempx(10 downto 1);

+/2C: tempy <= (orig_y + endp_y);

if(yltflg = '1') then

ymid <= (‘0’ & tempy(10 downto 1)) + (“0000000000” & tempy(0));

else

ymid <= ‘0’ & tempy(10 downto 1);

slide10

int orig_x, orig_y, endp_x, endp_y, midp_x, midp_y;

if(orig_x > endp_x)

then exchange orig and endp;

push endp;

push endp

while(stack is not empty)

// compute midp

midp_x = (orig_x + endp_x)/2;

if(endp_y < orig_y)

then midp_y = (orig_y + endp_y)/2 (rounded);

else midp_y = (orig_y + endp_y)/2;

if(midp = orig)

then

plot orig;

pop orig;

pop endp;

else

push endp;

push midp;

endp = midp;

end while;