CodeBase - Line Plotter

Return to the CodeBase listing

Category: Basic 2D

Version: 1.0

0
0

Information

Uploaded: 17th Feb 2006 09:48

Modified: 17th Feb 2006 11:51

Author:  Mark Garrett

Summary

draws a dot-line from one screen coordinate to the next. Line plotter simply takes the largest span between 2 coordinates (let's say 'y' is the largest span between 2 coordinates) and divides it by by the smaller span which would be the x span, thereby arriveing at the add-amount for each dot drawn between the 2 coordinates.

Full Description

A way of drawing lines between 2 coordinates on the screen without using the 'line' command and doing it with dots only...<br /> <br /> example-<br /> draw a line between coordinate'a' and coordinate'b'=<br /> <br /> where<br /> coordinate'a' = x 100, y 500 <br /> <br /> and<br /> coordinate'b' = x1 400, y1 600<br /> <br /> <br /> x1 - x = 300 <br /> y1 - y = 100<br /> <br /> 'x'span = 300<br /> 'y'span = 100<br /> <br /> 'x'span / 'y'span = 3<br /> <br /> addition'y' = y 3<br /> <br /> thus: <br /> <br /> dot 1 = x100, y500 <br /> dot 2 = x101, y503<br /> dot 3 = x102, y506<br /> dot 4 = x103, y509 etc. etc. till the line is drawn completely from coordinate-a to coordinate-b<br /> <br /> <br /> <br />

Comments

No comments yet.