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

Draws a triangle to the page. The first two arguments specify the first point, the middle two arguments specify the second point, and the last two arguments specify the third point.

Type: function

Parameter(s):

  • x1 {Number}:

    X-coordinate of Point 1.

  • y1 {Number}:

    Y-coordinate of Point 1.

  • x2 {Number}:

    X-coordinate of Point 2.

  • y2 {Number}:

    Y-coordinate of Point 2.

  • x3 {Number}:

    X-coordinate of Point 3.

  • y3 {Number}:

    Y-coordinate of Point 3.

Returns:

  • {Polygon}:

    The new triangle as a Polygon object.