EZ Programing Demos

Slow motion, step by step, animated demonstrations of basic computer programing techniques

Links to topics:

Current topic:

Plotting a line

Well, it's actually a line segment, and it's drawn between two endpoints, (x1, y1) and (x2, y2).

Try the demo below and experiment with changing the values of the coordinates. There is more information below.

 Slow  Medium  Fast 
Click 'Run' to go.

Perhaps this is not the best name for this command. Really, the command line draws a line segment, since the graphic has endpoints. A line, as usually encountered in geometry, goes on to infinity. It has no endpoints. However, many computer languages use this shorthand name for the command, and we will do also here.


We will call the first endpoint (x1, y1), and we will call the second endpoint (x2, y2). Here's a picture of a line segment drawn between two endpoints:


In our demo below the command to draw a line segment is named line. This command is followed by four expressions separated by commas. The expressions here are simple numbers. The first two numbers represent the coordinates for one endpoint, (x1, y1). The next two numbers are the coordinates for the other endpoint, (x2, y2).


Here's a simple flowchart for this program:


In an imaginary computer language this could look like the following:

    line(0, 0, 5, 7);


Suggested next article:

At EZ Math Movie

EZ Math Movie is a site that can help you experiment with and understand many topics in mathematics. Its main feature is an interactive animated (x, y) graph that you control with an actual programing language. There are many examples and tutorials, and EZ Math Movie is crossed referenced with both EZ Programing Demos and Zona Land Education.


Zona Land Education is a site with explanations and interactive diagrams covering many topics in physics and mathematics. Zona Land Education is cross referenced with EZ Math Movie, and it contains several animations that use EZ Math Movie's programing language.