Reflect the vector of move direction
reflect vector
Reflects the vector of turtle's moves symetrically w.r.t. the vector specified as a 2-element list or
array. The turtle's move direction is used by the move
instruction.
Note: forward
and back
instructions turn the move direction to heading
before the step
is made.
Example:
repeat 3 [
cs
move 50
"h := -180 + 15 * repcount
"v := array cos :h-90 cos :h
(print :h :v)
reflect :v
move 50
wait 500
]
repeat 3 [
cs
move 50
"h := 15 * repcount
"v := array cos :h-90 cos :h
(print :h :v)
reflect :v
move 50
wait 500
]
Output:
-165 {-0.258819045102521 -0.965925826289068}
-150 {-0.5 -0.866025403784439}
-135 {-0.707106781186548 -0.707106781186547}
15 {0.258819045102521 0.965925826289068}
30 {0.5 0.866025403784439}
45 {0.707106781186548 0.707106781186548}
See also:
Table of Content