diff --git a/freecad/gears/bevelgear.py b/freecad/gears/bevelgear.py index 54416a9..6a147e4 100644 --- a/freecad/gears/bevelgear.py +++ b/freecad/gears/bevelgear.py @@ -119,7 +119,7 @@ def generate_gear_shape(self, fp): fp.gear.clearance = fp.clearance / scale fp.gear._update() pts = list(fp.gear.points(num=fp.numpoints)) - rot = rotation3D(2 * np.pi / fp.teeth) + rot = rotation3D(- 2 * np.pi / fp.teeth) # if fp.beta.Value != 0: # pts = [np.array([self.spherical_rot(j, fp.beta.Value * np.pi / 180.) for j in i]) for i in pts] @@ -142,7 +142,7 @@ def generate_gear_shape(self, fp): else: for scale_i in np.linspace(scale_0, scale_1, 20): # beta_i = (scale_i - scale_0) * fp.beta.Value * np.pi / 180 - # rot = rotation3D(beta_i) + # rot = rotation3D(- beta_i) # points = [rot(pt) * scale_i for pt in pts] angle = ( fp.beta.Value @@ -203,4 +203,4 @@ def scale(x): def spherical_rot(self, point, phi): new_phi = np.sqrt(np.linalg.norm(point)) * phi - return rotation3D(new_phi)(point) + return rotation3D(- new_phi)(point) diff --git a/freecad/gears/cycloidgear.py b/freecad/gears/cycloidgear.py index ce709a5..bd21d5d 100644 --- a/freecad/gears/cycloidgear.py +++ b/freecad/gears/cycloidgear.py @@ -155,7 +155,7 @@ def generate_gear_shape(self, fp): fp.gear._update() pts = fp.gear.points(num=fp.numpoints) - rot = rotation(-fp.gear.phipart) + rot = rotation(fp.gear.phipart) rotated_pts = list(map(rot, pts)) pts.append([pts[-1][-1], rotated_pts[0][0]]) pts += rotated_pts diff --git a/freecad/gears/internalinvolutegear.py b/freecad/gears/internalinvolutegear.py index 598962f..452bff6 100644 --- a/freecad/gears/internalinvolutegear.py +++ b/freecad/gears/internalinvolutegear.py @@ -196,7 +196,7 @@ def generate_gear_shape(self, fp): if not fp.simple: # head-fillet: pts = fp.gear.points(num=fp.numpoints) - rot = rotation(-fp.gear.phipart) + rot = rotation(fp.gear.phipart) rotated_pts = list(map(rot, pts)) pts.append([pts[-1][-1], rotated_pts[0][0]]) pts += rotated_pts diff --git a/freecad/gears/involutegear.py b/freecad/gears/involutegear.py index c384168..fe31488 100644 --- a/freecad/gears/involutegear.py +++ b/freecad/gears/involutegear.py @@ -206,7 +206,7 @@ def generate_gear_shape(self, obj): if not obj.simple: pts = obj.gear.points(num=obj.numpoints) - rot = rotation(-obj.gear.phipart) + rot = rotation(obj.gear.phipart) rotated_pts = list(map(rot, pts)) pts.append([pts[-1][-1], rotated_pts[0][0]]) pts += rotated_pts diff --git a/freecad/gears/lanterngear.py b/freecad/gears/lanterngear.py index e32beb4..7859ce1 100644 --- a/freecad/gears/lanterngear.py +++ b/freecad/gears/lanterngear.py @@ -112,7 +112,7 @@ def find_phi_min(phi_min): app.Vector(*p_1, 0.0), app.Vector(*p_12, 0.0), app.Vector(*p_2, 0.0) ).toShape() - rot = rotation(-np.pi * 2 / teeth) + rot = rotation(np.pi * 2 / teeth) p_3 = rot(np.array([p_2_end]))[0] # l = part.LineSegment(fcvec(p_1_end), fcvec(p_3)).toShape() l = part_arc_from_points_and_center( diff --git a/freecad/gears/timinggear_t.py b/freecad/gears/timinggear_t.py index b43e80f..dd96f41 100644 --- a/freecad/gears/timinggear_t.py +++ b/freecad/gears/timinggear_t.py @@ -93,7 +93,7 @@ def dist_p2(s): mirror = reflection(0.0) # reflect the points at the x-axis p_3, p_4 = mirror(np.array([p_2, p_1])) - rot = rotation(-gamma_0) # why is the rotation in wrong direction ??? + rot = rotation(gamma_0) # why is the rotation in wrong direction ??? p_5 = rot(np.array([p_1]))[0] # the rotation expects a list of points l1 = part.LineSegment(fcvec(p_1), fcvec(p_2)).toShape() diff --git a/pygears/_functions.py b/pygears/_functions.py index 07c6613..84e3ea9 100644 --- a/pygears/_functions.py +++ b/pygears/_functions.py @@ -42,7 +42,6 @@ def reflection3D(angle): ) def func(x): - # why not use mat @ x return dot(x, mat) return func @@ -50,8 +49,8 @@ def func(x): def rotation(angle, midpoint=None): midpoint = midpoint or [0.0, 0.0] - mat = array([[cos(angle), -sin(angle)], - [sin(angle), cos(angle)]]) + mat = array([[cos(angle), sin(angle)], + [-sin(angle), cos(angle)]]) midpoint = array(midpoint) vec = midpoint - dot(midpoint, mat) trans = translation(vec) @@ -64,8 +63,8 @@ def func(xx): def rotation3D(angle): mat = array( - [[cos(angle), -sin(angle), 0.0], - [sin(angle), cos(angle), 0.0], + [[cos(angle), sin(angle), 0.0], + [-sin(angle), cos(angle), 0.0], [0.0, 0.0, 1.0]] ) diff --git a/pygears/bevel_tooth.py b/pygears/bevel_tooth.py index c0a4389..24fa57a 100644 --- a/pygears/bevel_tooth.py +++ b/pygears/bevel_tooth.py @@ -213,13 +213,13 @@ def involute_points(self, num=10): intersection_point = intersection_line_circle(xy[i], point, r_cut) xy = array([intersection_point] + list(xy[i + 1 :])) xyz = [[p[0], p[1], 1] for p in xy] - backlash_rot = rotation3D(self.angular_backlash / 2) + backlash_rot = rotation3D(- self.angular_backlash / 2) xyz = backlash_rot(xyz) return xyz def points(self, num=10): pts = self.involute_points(num=num) - rot = rotation3D(-pi / self.z / 2) + rot = rotation3D(pi / self.z / 2) pts = rot(pts) ref = reflection3D(pi / 2) pts1 = ref(pts)[::-1] diff --git a/pygears/cycloid_tooth.py b/pygears/cycloid_tooth.py index 1a9504a..b832411 100644 --- a/pygears/cycloid_tooth.py +++ b/pygears/cycloid_tooth.py @@ -110,7 +110,7 @@ def points(self, num=10): pts_outer = transpose([pts_outer_x, pts_outer_y]) pts_inner = transpose([pts_inner_x, pts_inner_y]) pts1 = vstack([pts_inner[:-2], pts_outer]) - rot = rotation(self.phipart / 4 - self.angular_backlash / 2) + rot = rotation(- self.phipart / 4 + self.angular_backlash / 2) pts1 = rot(pts1) ref = reflection(0.0) pts2 = ref(pts1)[::-1] diff --git a/pygears/involute_tooth.py b/pygears/involute_tooth.py index 834f3db..3755110 100644 --- a/pygears/involute_tooth.py +++ b/pygears/involute_tooth.py @@ -125,7 +125,7 @@ def undercut_points(self, num=10): y = array(list(map(fy, pts))) xy = transpose([x, y]) rotate = rotation( - self.undercut_rot + self.phipart / 2 - self.angular_backlash / 2 + - self.undercut_rot - self.phipart / 2 + self.angular_backlash / 2 ) xy = rotate(xy) return array(xy) @@ -136,7 +136,7 @@ def involute_points(self, num=10): x = array(list(map(fx, pts))) fy = self.involute_function_y() y = array(list(map(fy, pts))) - rot = rotation(self.involute_rot - self.angular_backlash / 2) + rot = rotation(- self.involute_rot + self.angular_backlash / 2) xy = rot(transpose(array([x, y]))) return xy @@ -168,10 +168,6 @@ def points(self, num=10): one_tooth = [u1, e1, [e1[-1], e2[0]], e2, u2] return one_tooth - def gearfunc(self, x): - rot = rotation(2 * x / self.dw, self.midpoint) - return rot - def undercut_function_x(self): def func(psi): return cos(psi - (self.df * tan(psi)) / self.dw) * sqrt( diff --git a/pygears/profile.py b/pygears/profile.py index c14a9fe..8af8a05 100644 --- a/pygears/profile.py +++ b/pygears/profile.py @@ -33,7 +33,7 @@ def profile(self, num=10): if self.rot3D: rot = rotation3D(np.pi * 2 / self.z) else: - rot = rotation(-np.pi * 2 / self.z) + rot = rotation(np.pi * 2 / self.z) profile = tooth for i in range(self.z - 1): tooth = rot(tooth).tolist()