Documentation

Function from library pytamaro

triangle(side1side2anglecolor)

triangleside1side2anglecolor

Creates a triangle given two sides and the angle between them, filled with a color.

The first side extends horizontally to the right. The second side extends from the left endpoint of the first side, rotated counterclockwise by the given angle. This point will be at the bottom left of the graphic, unless the specified angle is more than 90 degrees.

The pinning position is the centroid of the triangle.

side1length of the first, horizontal side of the triangle

side2length of the second side of the triangle

angleangle between the two sides, in degrees

colorthe color to be used to fill the triangle

The specified triangle as a graphic
Code
show_graphic(triangle(100, 100, 60, red))
Output
Graphical output from execution result
Code
show_graphic(triangle(100, 100, 120, red))
Output
Graphical output from execution result

Logo of PyTamaro

PyTamaro is a project created by the Lugano Computing Education Research Lab at the Software Institute of USI

Privacy PolicyPlatform Version 51a7c2e (Tue, 22 Apr 2025 08:35:06 GMT)