TurtleGraphics

Documentation

turtle_getpos {TurtleGraphics}R Documentation

Get the Turtle's Current Position and Direction

Description

turtle_getpos returns the Turtle's current position on the plane.

turtle_getangle returns the Turtle's current direction, in degrees. An angle of 0 represents a north-facing Turtle.

Usage

turtle_getpos()

turtle_getangle()

Details

The terrarium must be initialized prior to using these functions, see turtle_init.

Value

Both functions return a (named) numeric vector. turtle_getpos returns a vector of length two which specifies the x and y coordinates. The turtle_getangle returns the angle.

See Also

Other TurtleGraphics: TurtleGraphics-package, turtle_do, turtle_goto, turtle_init, turtle_move, turtle_param, turtle_reset, turtle_show, turtle_status, turtle_turn, turtle_up

Examples

turtle_init()
turtle_getpos()["x"] # x coordinate
turtle_getpos()["y"] # y coordinate
 

[Package TurtleGraphics version 1.0-6 Index]