Set mode of crossing the edges

window
wrap
fence
bounce

Change the mode of crossing the edges of graphics window:

window - edges are crossed with no changes in the heading and position of a turtle;

wrap - turtle that crosses the edge is moved to the opposite edge and continues a move instruction without changing the heading; left-right and top-bottom edges are "glued";

fence - turtle is stopped in the distance from the edge equal to the turtle's radius;

bounce - turtle is reflected from the edge (at the distance equal to the turtle's radius), turtle's move direction is changed to the symmetrical w.r.t. the normal to the edge, heading is changed to symmetrical w.r.t. the edge.

Example:

window
setpc "black
rt 20 fd 600
pu home pd

wrap
setpc "red
rt 25 fd 600
pu home pd

fence
setpc "green
rt 30 fd 600
pu home pd

bounce
setpc "blue
rt 35 fd 600
pu home pd

Output: a drawing in the graphics window.

See also:

Table of Content