Functions for for intersect
This commit is contained in:
parent
d26fcc5271
commit
a053a66e69
@ -22,6 +22,21 @@ outer_ring_diameter=rod_thickness+2*loop_thickness
|
||||
center_x=end_x-math.cos(math.radians(angle))*outer_ring_diameter/2
|
||||
center_y=end_y-math.sin(math.radians(angle))*outer_ring_diameter/2
|
||||
|
||||
def findRodInter(n_x, n_y):
|
||||
p = Point(center_x, center_y)
|
||||
c = p.buffer(rod_thickness/2).boundary
|
||||
l = LineString([(n_x, n_y), (n_x+100*math.cos(math.radians(-slant_degree)), n_y+100*math.sin(math.radians(-slant_degree)))])
|
||||
i = c.intersection(l)
|
||||
|
||||
if len(i.geoms) > 1 and i.geoms[0].coords[0][0] > i.geoms[1].coords[0][0]:
|
||||
x = i.geoms[1].coords[0][0]
|
||||
y = i.geoms[1].coords[0][1]
|
||||
else:
|
||||
x = i.geoms[0].coords[0][0]
|
||||
y = i.geoms[0].coords[0][1]
|
||||
return x, y
|
||||
|
||||
|
||||
base = base.hLine(width).polarLine(stepper_motor_size-5,270-slant_degree).tangentArcPoint((end_x, end_y), relative=False)
|
||||
d=20
|
||||
t=6
|
||||
@ -31,20 +46,12 @@ base = base.threePointArc((center_x+outer_ring_diameter/2 ,center_y), (outer_x,
|
||||
|
||||
n_x=base.val().endPoint().toTuple()[0]
|
||||
n_y=base.val().endPoint().toTuple()[1]
|
||||
coor_x, coor_y = findRodInter(n_x, n_y)
|
||||
last_x, last_y = findRodInter(n_x, n_y+2)
|
||||
|
||||
p = Point(center_x, center_y)
|
||||
c = p.buffer(rod_thickness/2).boundary
|
||||
l = LineString([(n_x, n_y), (n_x+100*math.cos(math.radians(-slant_degree)), n_y+100*math.sin(math.radians(-slant_degree)))])
|
||||
i = c.intersection(l)
|
||||
log((n_x,n_y))
|
||||
log((n_x+10*math.cos(math.radians(-slant_degree)), n_y+10*math.sin(math.radians(-slant_degree))))
|
||||
log((i.geoms[0].coords[0][0], i.geoms[0].coords[0][1]))
|
||||
|
||||
|
||||
|
||||
#base = base.polarLine(15.5, -slant_degree)
|
||||
base = base.lineTo(i.geoms[1].coords[0][0], i.geoms[1].coords[0][1])
|
||||
base = base.threePointArc((center_x+rod_thickness/2 ,center_y), (center_x+math.cos(math.radians(180))*rod_thickness/2, center_y+math.sin(math.radians(180))*rod_thickness/2)).polarLine(15, 180-slant_degree)
|
||||
base = base.lineTo(coor_x, coor_y)
|
||||
base = base.threePointArc((center_x+rod_thickness/2, center_y), (last_x, last_y))
|
||||
base = base.polarLine(15, 180-slant_degree)
|
||||
base = base.close().extrude(20)
|
||||
|
||||
# Render
|
||||
|
Loading…
x
Reference in New Issue
Block a user