Skip to content

Commit 2fd087f

Browse files
authored
Fixed linting and test errors for changes in CQ since PR was first opened (#36)
1 parent de5a349 commit 2fd087f

File tree

5 files changed

+330
-173
lines changed

5 files changed

+330
-173
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
from .main import *
1+
from .main import *
Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from math import cos, sin, radians, acos
22
import cadquery as cq
33

4+
45
def involute(r: float, sign: int = 1):
56
"""
67
Defines an involute curve to create the flanks of the involute gears
@@ -12,12 +13,15 @@ def involute(r: float, sign: int = 1):
1213
Returns:
1314
x,y -> tuple() : 2-tuple of x and y coordinates in space
1415
"""
16+
1517
def curve(t):
16-
x = r*(cos(t) + t*sin(t))
17-
y = r*(sin(t) - t*cos(t))
18-
return x,sign*y
18+
x = r * (cos(t) + t * sin(t))
19+
y = r * (sin(t) - t * cos(t))
20+
return x, sign * y
21+
1922
return curve
2023

24+
2125
def spherical_involute(delta, delta_b, R):
2226
"""
2327
Equation of the spherical involute that lies on a sphere
@@ -30,19 +34,22 @@ def spherical_involute(delta, delta_b, R):
3034
Returns:
3135
x,y,z -> tuple() : 3-tuple of x and y and z coordinates in space
3236
"""
33-
theta = acos(cos(delta)/cos(delta_b))/sin(delta_b)
34-
x = R*cos(theta*sin(delta_b))*sin(delta_b)*cos(theta) - R*sin(theta*sin(delta_b))* - sin(theta)
35-
y = R*cos(theta*sin(delta_b))*sin(delta_b)*sin(theta) - R*sin(theta*sin(delta_b))* cos(theta)
36-
z = R*cos(theta*sin(delta_b))*cos(delta_b)
37-
return x,y,z
38-
37+
theta = acos(cos(delta) / cos(delta_b)) / sin(delta_b)
38+
x = R * cos(theta * sin(delta_b)) * sin(delta_b) * cos(theta) - R * sin(
39+
theta * sin(delta_b)
40+
) * -sin(theta)
41+
y = R * cos(theta * sin(delta_b)) * sin(delta_b) * sin(theta) - R * sin(
42+
theta * sin(delta_b)
43+
) * cos(theta)
44+
z = R * cos(theta * sin(delta_b)) * cos(delta_b)
45+
return x, y, z
3946

4047

4148
def rotate_vector_2D(vector: cq.Vector, angle: float):
4249
"""
4350
Rotates a 2D cq.Vector `vector`by an angle of `angle` in degrees
4451
"""
4552
angle = radians(angle)
46-
x = cos(angle)*vector.x - sin(angle)*vector.y
47-
y = sin(angle)*vector.x + cos(angle)*vector.y
48-
return cq.Vector((x,y))
53+
x = cos(angle) * vector.x - sin(angle) * vector.y
54+
y = sin(angle) * vector.x + cos(angle) * vector.y
55+
return cq.Vector((x, y))

0 commit comments

Comments
 (0)