Rubber Band Technique in Computer Graphics

Rubber Band Technique:

This technique is employed extensively in graphics packages for drawing graphics entities using a mouse only. In this technique, when the user clicks the mouse button the starting position is established. As the user moves the mouse, the cursor moves from the first point to the second, the program displays a line from the first endpoint to the current or a circle centred at the first endpoint and passing through the current point or a rectangle with one corner at the first point and the other corner at the current point.

In this method, the user generally has to drag the mouse pointer, to move the mouse while cursor while the button is down. The entity shape or size is dynamically changed with every mouse movement while the button is down. When the button is released, the endpoint is frozen and the figure is there at its final shape, size and position.

Rubber Band Algorithm: