Home › Forums › Nazca › How to draw a triangle
Tagged: polygon, triangle
Dear Nazca team,
I would like to draw a triangle with knowing a length and two angles.
Within the geometries module, I saw rectangle, tetragon and trapezoid, but no triangle.
A straight forward way to define these kind of structures is to create a function that returns your custom polygon (list of points) and create a Polygon mask element from the list of points:
from math import tan, radians
import nazca as nd
def triangle(length=10, angle=45):
base = 2*length*tan(radians(0.5*angle))
return [(0, 0.5*base), (0, -0.5*base), (length, 0)]
tri = nd.Polygon(points=triangle(length=50, angle=30))
tri.put(0, 10, 45)
© 2022 Nazca Design. | email@example.com