lion Cookie Cutter 2

lion Cookie Cutter 2

thingiverse

A Python script to create a polygon from the given set of vertices! Here's the code: ``` vertices = [ [-25.48504323978455, 47.91503746487946], [-19.11987795522592, 46.927736095006445], [-12.754712570667294, 46.040434725133414], [-6.389547185108658, 45.153133355260384], [0.27561820055027176, 44.26583198538735], [6.940763486010201, 43.37853061551432], [13.60590877144952, 42.49122924564129], [20.271053056888844, 41.60402787576826], [26.936197342328175, 40.71672650589524] ] import math def dist(x1, y1, x2, y2): return math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2) def pointInsidePolygon(vertices, point_x, point_y, radius): num = [] for i in range(len(vertices)): j = (i+1)%len(vertices) if ((vertices[j][1]-point_y)*(vertices[i][0]- point_x))>(point_y-vertices[i][1])*(vertices[j][0]- point_x): num.append(0) else: num.append(1) num.append(num[0]) intersectionCount = 0 for i in range(len(num)): if (num[i]!=num[i+1]): intersectionCount += 1 if (intersectionCount %2 != 0): return False; else: closest_intersection_dist=9999999999; for j in range(len(vertices)): i=(j+1)%len(vertices); if (((vertices[j][0] <= point_x)*(point_x<vertices[i][0])+(vertices[j][1]< point_y)*(point_y<= vertices[i][1])+((point_x<=vertices[j][0]*1.000001)*(point_y> vertices[j][1]-radius)*( dist(vertices[j][0],vertices[j][1], point_x,point_y)<closest_intersection_dist)+( (dist(vertices[j][0]+1.0*radius , vertices[i][1],point_x ,point_y)< closest_intersection_dist))) ): if (abs(dist(point_x, point_y,vertices[i] [0], vertices[i] [1]))< radius+0.5): closest_intersection_dist=dist(vertices[j] [0], vertices[i][1], point_x,point_y) return abs(closest_intersection_dist -radius) > 0.000001 import matplotlib.pyplot as plt wall_thickness = 0.8 inside_count=0; points = [[i,j] for i in range(30) for j in range(-10,-10-wall_thickness*40, -wall_thickness)]; for x in points: inside_point= pointInsidePolygon(vertices,x[0],x[1], radius= 5) if (inside_point== True): inside_count+=1 print(f'There are {inside_count} valid interior lattice sites') vertices= np.array(vertices); X=[] Y=[] for x in vertices: X.append(x[0]); Y.append(x[1]) fig, ax = plt.subplots() plt.plot(X,Y,'o', color='r') for x in points: ax.add_patch(patches.Circle(x,radius=5,alpha=0.1)); ax.set_aspect('equal') print(pointInsidePolygon(vertices,[15,60],[20,65],radius=6)) ``` Please note this code assumes `numpy` is installed as a dependency (you can do `pip install numpy matplotlib`)

Download Model from thingiverse

With this file you will be able to print lion Cookie Cutter 2 with your 3D printer. Click on the button and save the file on your computer to work, edit or customize your design. You can also find more 3D designs for printers on lion Cookie Cutter 2.