I am trying to make a shamrock crystal for later fabrication, and am using nazca design tool for doing it.
How can I place the trapezoid so that the sides of the trapezoid are parallel to the cyrcles and are always at the end of the sharp corners.
import nazca as nd
import numpy as np
# Define parameters
a = 500
semib = 0.255 * a
semia = semib * 0.75
shift = 0.22 * a
thickness = 0.65 * a
f = 2 * semia / np.sqrt(3)
r = semia
with nd.Cell(name="shamrock") as sham:
# Create circles for the shamrock pattern
circ1 = nd.geometries.circle(radius=semia, N=100)
circ2 = nd.geometries.circle(radius=semia, N=100)
circ3 = nd.geometries.circle(radius=semia, N=100)
# Create Polygon objects for circles
circ1_polygon = nd.Polygon(layer=56, points=circ1)
circ2_polygon = nd.Polygon(layer=56, points=circ2)
circ3_polygon = nd.Polygon(layer=56, points=circ3)
# Place circles for the shamrock pattern using put
circ1_polygon.put(0, shift)
circ2_polygon.put(-shift * 0.5 * np.sqrt(3), -shift * 0.5)
circ3_polygon.put(shift * 0.5 * np.sqrt(3), -shift * 0.5)
# Identify sharp corners
sharp_corner1 = ((-shift * 0.5 * np.sqrt(3)) / 2, (shift + (-shift * 0.5)) / 2)
sharp_corner2 = ((0 + (shift * 0.5 * np.sqrt(3))) / 2, (shift + (-shift * 0.5)) / 2)
sharp_corner3 = ((-shift * 0.5 * np.sqrt(3) + (shift * 0.5 * np.sqrt(3))) / 2, (-shift * 0.5 + (-shift * 0.5)) / 2)
semicircle_radius = f-r
# Create trapezoid using the trapezoid function
trapezoid_shape = nd.geometries.trapezoid(length=50, height=160, angle1=132, angle2=132, position=1)
# Create Polygon object for trapezoid
trapezoid_polygon = nd.Polygon(layer=56, points=trapezoid_shape)
# Place trapezoid at the sharp corners
trapezoid_polygon.put(25,75,180)
nd.export_plt(sham)
And here is the picture.
Ideally would be nice to have something like this with the smoothen corners. But I was thinking to put a trapezoid on top to have smoothen the sharper corners.
This can be done by growing and shrinking the polygons in Nazca:
import nazca as nd
import numpy as np
# Define parameters
a = 500
semib = 0.255 * a
semia = semib * 0.75
shift = 0.22 * a
thickness = 0.65 * a
f = 2 * semia / np.sqrt(3)
r = semia
with nd.Cell(name="shamrock") as sham:
# Create circles for the shamrock pattern
circ1 = nd.geometries.circle(radius=semia, N=100)
circ2 = [(x - semia, y - np.sqrt(3) * semia) for x, y in circ1]
circ3 = [(x + semia, y - np.sqrt(3) * semia) for x, y in circ1]
# grow and shrink 20%
pols = nd.grow_polygons([circ1, circ2, circ3], 0.2 * semia)
pols = nd.grow_polygons(pols, -0.2 * semia)
for p in pols:
nd.Polygon(layer=56, points=p).put()
nd.export_plt(sham)