drawTriangle()
[Graphics]
void drawTriangle (int x1, int y1, int x2, int y2, int x3, int y3);Description
Draws a triangle on the chip.
Parameters
x1: the x-coordinate of the first point of the
triangle.
y1: the y-coordinate of the first point of the
triangle.
x2: the x-coordinate of the second point of the
triangle.
y2: the y-coordinate of the second point of the
triangle.
x3: the x-coordinate of the third point of the
triangle.
y3: the y-coordinate of the third point of the
triangle.
Returns
Nothing.
Example Code
The code draws a triangle on the chip, with the three points at (10, 10), (20, 30), and (30, 10).
void setup() {
int width = chipWidth(); // gets the width of the chip
int height = chipHeight(); // gets the height of the chip
// draws a triangle on the chip, with the three points
// at (10, 10), (20, 30), and (30, 10)
drawTriangle(10, 10, 20, 30, 30, 10);
}
void loop() {
}Notes and Warnings
All coordinates must be inside the chip boundaries, use the functions
chipWidth() and chipHeight() to get the chip
dimensions.
