How do you position the triangle() command?
I have a question that is not related to technical problems. For the computer programming, what are the different coordinates for a triangle?
Hi Arya,
The triangle command looks like this:
triangle(x1, y1, x2, y2, x3, y3);
The first two numbers of the triangle command are the x and y coordinates of the first point, similar to how you would position the x and y coordinates of an ellipse. The third and fourth numbers are the x and y coordinates of the second point. The fifth and sixth numbers are the x and y coordinates of the third point. Using those numbers, you should be able to position the triangle how you want it. Sometimes it can help to position three points or ellipses in the spots where you want the points of the triangle to be.
If you haven't checked it out yet, this program gives you an example of using the triangle command: https://www.khanacademy.org/computer-programming/trianglex1-y1-x2-y2-x3-y3-processingjs/839546599.
Hope this helps!
Please sign in to leave a comment.