Turtle graphics commands
Turtle Graphics Commands |
Material commands
Texturing commands -- not implemented yet.
Font commands
Querying commands
Other commands
Moving the turtle |
These commands can be used to change the position of the turtle. The turtle's orientation stays the same. There are three frames of reference systems to move the turtle:
- Egocentric: the turtle changes position according to its orientation or heading direction. These include FORWARD and BACK commands.
- Fixed: the turtle changes position regardless its orientation. These include EAST, WEST, NORTH, SOUTH, UP, and DOWN commands.
- Coordinate: the turtle changes position according to the given 3D coordinate. These include SETX, SETY, SETZ, SETXYZ, and SETPOS.
* Every moving command has its jump command such as JUMPFORWARD for FORWARD. When pen is up, the jump series commands act the same as normal moving commands. They are used when pen is down, and you want to temporarily disconnect the turtle tracks. Using jump series commands will never have turtle tracks.
Egocentric |
FORWARD distance
FD distance
* JUMPFORWARD distance
* JUMPFORTH distance
* JF distance
FORWARD moves the turtle forward the given number of distance in the current heading direction. The default unit for distance is meter. This can be changed by using METER or CENTIMETER (CM). If the pen is currently down, the turtle will draw a line along its path. If the given input is not a number, FORWARD will throw an error.
BACK distance BACKWARD distance BK distance
* JUMPBACK distance
* JUMPBACKWARD distance
* JB distance
BACK moves the turtle the given number of distance in the direction opposite from the current heading direction. The default unit for distance is meter. This can be changed by using METER or CENTIMETER (CM). If the pen is currently down, the turtle will draw a line along its path. If the given input is not a number, BACK will throw an error.
Fixed |
EAST distance
* JUMPEAST distance
*JE distance
EAST moves the turtle the given number of distance towards the east direction regardless the current heading direction. The default unit for distance is meter. This can be changed by using METER or CENTIMETER (CM). If the pen is currently down, the turtle will draw a line along its path. If the given input is not a number, EAST will throw an error.
WEST distance
* JUMPWEST distance
* JW distance
WEST moves the turtle the given number of distance towards the west direction regardless the current heading direction. The default unit for distance is meter. This can be changed by using METER or CENTIMETER (CM). If the pen is currently down, the turtle will draw a line along its path. If the given input is not a number, WEST will throw an error.
* JUMPNORTH distance
* JN distance
NORTH moves the turtle the given number of distance towards the north direction regardless the current heading direction. The default unit for distance is meter. This can be changed by using METER or CENTIMETER (CM). If the pen is currently down, the turtle will draw a line along its path. If the given input is not a number, NORTH will throw an error.
* JUMPSOUTH distance
* JS distance
SOUTH moves the turtle the given number of distance towards the south direction regardless the current heading direction. The default unit for distance is meter. This can be changed by using METER or CENTIMETER (CM). If the pen is currently down, the turtle will draw a line along its path. If the given input is not a number, SOUTH will throw an error.
* JUMPUP distance
* JU distance
UP moves the turtle the given number of distance towards the sky direction regardless the current heading direction. The default unit for distance is meter. This can be changed by using METER or CENTIMETER (CM). If the pen is currently down, the turtle will draw a line along its path. If the given input is not a number, UP will throw an error.
DN distance
* JUMPDOWN distance
* JD distance
DOWN moves the turtle the given number of distance towards the ground direction regardless the current heading direction. The default unit for distance is meter. This can be changed by using METER or CENTIMETER (CM). If the pen is currently down, the turtle will draw a line along its path. If the given input is not a number, DOWN will throw an error.
Coordinate |
This set of coordinate commands moves the turtle to an absolute position. Please note that the value given to this set of commands will not accumulate as the egocentric and fixed moving commands.
SETPOS poslist
* JUMPPOS poslist
* JPOS poslist
* JP poslist
SETPOS moves the turtle to the coordinates specified by the input position list. The input must be a three-element list, the first element being the x-coordinate, the second being the y-coordinate, and the third being the z-coordinate. The heading of the turtle is not changed. The coordinate is also influenced by METER or CENTIMETER (CM). If the pen is currently down, the turtle will draw a line along its path. If the given input is not a list or does not contain exactly three numeric elements, SETPOS will throw an error.
Example:
? SETPOS [ 0 0 0 ]
SETX moves the turtle such that its y and z positions remains the same but its x position is the given value. The heading of the turtle is not changed. The coordinate is also influenced by METER or CENTIMETER (CM). If the pen is currently down, the turtle will draw a line along its path. If the given input is not a number, SETX will throw an error.
SETY moves the turtle such that its x and z positions remains the same but its y position is the given value. The heading of the turtle is not changed. The coordinate is also influenced by METER or CENTIMETER (CM). If the pen is currently down, the turtle will draw a line along its path. If the given input is not a number, SETY will throw an error.
SETZ moves the turtle such that its x and y positions remains the same but its z position is the given value. The heading of the turtle is not changed. The coordinate is also influenced by METER or CENTIMETER (CM). If the pen is currently down, the turtle will draw a line along its path. If the given input is not a number, SETZ will throw an error.
* JUMPXYZ xcor ycor zcor
* JXYZ xcor ycor zcor
SETXYZ moves the turtle such that its x, y, and z positions become the given values. The heading of the turtle is not changed. The coordinate is also influenced by METER or CENTIMETER (CM). If the pen is currently down, the turtle will draw a line along its path. If the given inputs are not numbers, SETXYZ will throw an error.
Example:
? SETXYZ 0 0 0
Turning the turtle |
These commands can be used to change the orientation or the heading of the turtle. The turtle's position stays the same. In three dimensional space, there are six turns as opposed to two turns (LEFT and RIGHT) in traditional 2D Logo. These turning commands are based on the turtle's current orientation.
RIGHT changes the turtle's heading by the specified number of degrees to its right. The turtle's position is not changed. 360 degrees is the same as 0 degree. The degree can be greater than 360. Negative degree means to turn LEFT. If the given input is not a number, RIGHT will throw an error.
LEFT changes the turtle's heading by the specified number of degrees to its left. The turtle's position is not changed. 360 degrees is the same as 0 degree. The degree can be greater than 360. Negative degree means to turn RIGHT. If the given input is not a number, LEFT will throw an error.
ROLLUP changes the turtle's heading by pitching up the specified number of degrees. The turtle's position is not changed. 360 degrees is the same as 0 degree. The degree can be greater than 360. Negative degree means to ROLLDOWN. If the given input is not a number, ROLLUP will throw an error.
ROLLDOWN changes the turtle's heading by pitching down the specified number of degrees. The turtle's position is not changed. 360 degrees is the same as 0 degree. The degree can be greater than 360. Negative degree means to ROLLUP. If the given input is not a number, LEFT will throw an error.
TILTRIGHT changes the turtle's heading by yawing the specified number of degrees to its right. The turtle's position is not changed. 360 degrees is the same as 0 degree. The degree can be greater than 360. Negative degree means to TILTLEFT. If the given input is not a number, TILTRIGHT will throw an error.
TILTLEFT changes the turtle's heading by yawing the specified number of degrees to its left. The turtle's position is not changed. 360 degrees is the same as 0 degree. The degree can be greater than 360. Negative degree means to TILTRIGHT. If the given input is not a number, TILTLEFT will throw an error.
Creating objects |
In the 3D space of VRMath, we can create geometrical objects. Even the turtle tracks are geometrical objects. They are not pen drawings of pixel on computer screen. All object can be affected by SCALE settings.
PENDOWN starts a turtle track object which can be POINTs, LINEs, or FACEs. Any subsequent move commands will cause the turtle to create points or lines or faces in the current pen color or material settings.
PENUP ends the current turtle track object. The turtle will not perform any drawing during subsequent move commands.
PENERASE is used only while it is PENDOWN. It will undo the last move of the turtle.
BOX or CUBE command creates a 1 meter^{3} cube with current material settings at turtle's current position and orientation.
BALL or SPHERE command creates a radius 0.5 meter sphere with current material settings at turtle's current position and orientation.
CONE command creates a 1 meter height and radius 0.5 meter circle bottom cone with current material settings at turtle's current position and orientation.
CAN or CYLINDER command creates a 1 meter height and radius 0.5 meter circle on top and bottom cylinder with current material settings at turtle's current position and orientation.
LABEL expr
LABEL creates the specified expression in 3D space as text according to the current material settings, font settings, and turtle's position and orientation. The expr should be a Logo WORD or LIST.
Example:
? LABEL "HelloWorld
? LABEL [I love VRMath!]
Colouring commands |
Colouring commands are used in association with POINT, LINE, and FACE objects created by PENDOWN and PENUP commands. In VRMath, there is a Pen Color Editor with 70 pre selected colours. VRMath uses the RGB model of expressing colours. Each value of R, G, and B is ranged between 0 to 1000.
SETBACKGROUND color
SETBG color
Color Palette Operations |
RESETPALETTE sets the color palette to its default.
CLEAN
CS
CLEAN fills the entire graphics window with the current background color. The current turtle position and state are not affected.
Turtle Motion |
Turtle Position Queries |
These commands can be used to get information about the turtle's position and heading.
XCOR returns the current x-coordinate of the turtle.
YCOR returns the current x-coordinate of the turtle.
Turtle State |
These commands manipulate other state information.
- 6808 reads