2D Shapes

Robot with 2D shapes

Basics

LINE :

line ( x1 , y1 , x2 , y2 );

Line got four parameters.First two parameters are beginning x-axis and y-axis point . And the third and fourth parameters are the end point x-axis and y-axis.

Example :
line(195 , 97 , 441 , 97);

coloured background

CIRCLE :

circle( x , y , radius )

Circle has three parameters, x-axis , y-axis and radius .The origin of the circle is in the centre .

Example :
circle( 617 , 761 , 150 );

coloured background

ELLIPSE :

ellipse( x , y , width , height )

Ellipse also has four parameters, x-axis and y-axis and width and the height. The origin of the ellipse is in the centre .If the width and the height are same then a circle is formed.But, if they are different they form an ellipse.

Example :
ellipse( 317 , 761 , 250 , 150 );

coloured background

RECTANGLE OR SQUARE :

rect( x , y , width , height )

Rect also got four parameter similar to the ellipse.The only difference is it's origin which is at the top left hand corner.It forms a square when the width and height are same.

Example :
rect( 243 , 451 , 150 , 150 );

coloured background

TRIANGLE :

triangle( x1 , y1 , x2 , y2 , x3 , y3)

Triangle got six parameters first set of x and y coordinates are for the first point, second set of x and y coordinates are for second point and the third set of x and y coordinates specify the third point of the triangle .

Example :
triangle( 333 , 170 , 257 , 287 , 400 , 287 );

coloured background

ARC :

arc( x-axis , y-axis , width , height , start , stop )

Arc got six parameters x-axis ,y-axis ,width ,height ,starting point and final stop where the angle is starting and finishing.There is a optional parameter CHORD and OPEN .If we add CHORD the arc becomes a close shape ,while the OPEN will not form any border and remain open.

coloured background coloured background

Continue Reading

Colours

Learn More

3D Shapes

Learn More

Map & Random

Learn More