diff --git a/pygears/_functions.py b/pygears/_functions.py index 80fefc1..07c6613 100644 --- a/pygears/_functions.py +++ b/pygears/_functions.py @@ -16,7 +16,6 @@ # * * # *************************************************************************** -from __future__ import division from numpy import sin, cos, dot, array, ndarray, vstack, transpose, sqrt from numpy.linalg import solve, norm @@ -26,7 +25,8 @@ def reflection(angle): [-sin(2 * angle), -cos(2 * angle)]]) def func(x): - # why not use mat @ x??? + # we do not use matrix-multiplication here because this is meant to work + # on an array of points return dot(x, mat) return func @@ -50,7 +50,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) @@ -63,7 +64,9 @@ def func(xx): def rotation3D(angle): mat = array( - [[cos(angle), -sin(angle), 0.0], [sin(angle), cos(angle), 0.0], [0.0, 0.0, 1.0]] + [[cos(angle), -sin(angle), 0.0], + [sin(angle), cos(angle), 0.0], + [0.0, 0.0, 1.0]] ) def func(xx): @@ -74,7 +77,8 @@ def func(xx): def translation(vec): def trans(x): - return [x[0] + vec[0], x[1] + vec[1]] + return [x[0] + vec[0], + x[1] + vec[1]] def func(x): return array(list(map(trans, x))) diff --git a/pygears/bevel_tooth.py b/pygears/bevel_tooth.py index ea1153a..c0a4389 100644 --- a/pygears/bevel_tooth.py +++ b/pygears/bevel_tooth.py @@ -16,8 +16,6 @@ # * * # *************************************************************************** -from __future__ import division -from __future__ import division from numpy import ( cos, sin, @@ -28,7 +26,6 @@ array, linspace, transpose, - vstack, sqrt, ) from ._functions import rotation3D, reflection3D, intersection_line_circle diff --git a/pygears/computation.py b/pygears/computation.py index bb0e1a8..bf22913 100644 --- a/pygears/computation.py +++ b/pygears/computation.py @@ -44,8 +44,9 @@ def root_inv(x): def d_root_inv(x): return 1.0 / np.cos(x) - 1 - - alpha_w = find_root(alpha, root_inv, d_root_inv) + + # use scipy (sp.optimize.minimize(f, f0, df).x) here (as we depent on scipy anyways) + alpha_w = find_root(alpha, root_inv, d_root_inv) dist = m * (t1 + t2) / 2 * np.cos(alpha) / np.cos(alpha_w) return dist, alpha_w diff --git a/pygears/cycloid_tooth.py b/pygears/cycloid_tooth.py index 8907ff4..1a9504a 100644 --- a/pygears/cycloid_tooth.py +++ b/pygears/cycloid_tooth.py @@ -16,7 +16,6 @@ # * * # *************************************************************************** -from __future__ import division from numpy import cos, sin, arccos, pi, array, linspace, transpose, vstack from ._functions import rotation, reflection diff --git a/pygears/involute_tooth.py b/pygears/involute_tooth.py index 6733406..834f3db 100644 --- a/pygears/involute_tooth.py +++ b/pygears/involute_tooth.py @@ -16,7 +16,6 @@ # * * # *************************************************************************** -from __future__ import division from numpy import ( tan, cos, diff --git a/pygears/profile.py b/pygears/profile.py index 4d8e597..c14a9fe 100644 --- a/pygears/profile.py +++ b/pygears/profile.py @@ -1,3 +1,22 @@ +# -*- coding: utf-8 -*- +# *************************************************************************** +# * * +# * This program is free software: you can redistribute it and/or modify * +# * it under the terms of the GNU General Public License as published by * +# * the Free Software Foundation, either version 3 of the License, or * +# * (at your option) any later version. * +# * * +# * This program is distributed in the hope that it will be useful, * +# * but WITHOUT ANY WARRANTY; without even the implied warranty of * +# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +# * GNU General Public License for more details. * +# * * +# * You should have received a copy of the GNU General Public License * +# * along with this program. If not, see . * +# * * +# *************************************************************************** + + import numpy as np from .involute_tooth import InvoluteTooth, InvoluteRack from .bevel_tooth import BevelTooth