Home › Forums › Nazca › How to draw a triangle
Tagged: polygon, triangle
This topic contains 1 reply, has 2 voices, and was last updated by Ronald 5 months, 2 weeks ago.
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)
You must be logged in to reply to this topic.
© 2019 Nazca Design. | email@example.com