diff options
author | “Humming-Owl” <“isaclien9752@gmail.com”> | 2023-08-29 01:59:50 -0400 |
---|---|---|
committer | “Humming-Owl” <“isaclien9752@gmail.com”> | 2023-08-29 01:59:50 -0400 |
commit | 4f8872265b483f0e6c6568dcb423b3638d5dee51 (patch) | |
tree | 20d45b689f470cb783019d3457aa5d0a0334d5b3 /my_functions.py | |
parent | c16097bbf4230bc761e0f60be238b3362ef89c2b (diff) | |
download | blenxy-4f8872265b483f0e6c6568dcb423b3638d5dee51.tar.gz blenxy-4f8872265b483f0e6c6568dcb423b3638d5dee51.zip |
some minor edits
Diffstat (limited to 'my_functions.py')
-rw-r--r-- | my_functions.py | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/my_functions.py b/my_functions.py index 1f76b82..49dc87d 100644 --- a/my_functions.py +++ b/my_functions.py @@ -94,28 +94,13 @@ def calc_translation_matrix(x_translation, y_translation, z_translation): ############################################################## # interpolate function -# used to find a value in an inte -rval with the specified mode. +# used to find a value in an interval with the specified mode. # So that it is clear that the values are points that have 2 # coordinates I will treat the input as they are (x,y) points # the function will either return m_x or m_y depending on -# which of the middle point value - -s is provided to the function +# which of the middle point values is provided to the function # (set None to the variable going to be returned by the -# function). Smooth will use the Cubic Hermite Spline -# interpolation method and will be the one using the point's -# derivatives/tangent. -# -# IMPORTANT (FOR SMOOTH INTERPOLA -TION): -# -# As I don't really have information on how to define -# tangent-out or tangent in/out interpolation (as JAE has -# already done those calculations) I will use the same -# interpolation method to both tangent-out or tangent in/out -# CSV files. If someone knows about this better please open -# an issue on blenxy's repository +# function). Only linear interpolation is supported for now. # # l_x (float) --> left point X axis component # l_y (float) --> left point Y axis component @@ -124,7 +109,6 @@ TION): # m_x (float) --> middle point X axis component # m_y (float) --> middle point Y axis component # interp_type (string) --> "linear" for linear interpolation -# "smooth" for smooth interpolation ############################################################## def interpolate(l_x, l_y, r_x, r_y, m_x, m_y, interp_type): # @@ -141,16 +125,17 @@ def interpolate(l_x, l_y, r_x, r_y, m_x, m_y, interp_type): ############################### # m_x is the one to be returned if (m_x == None): + + # linear interpolation if (interp_type == "linear"): m_x = (((r_x - l_x) / (r_y - l_y)) * (m_y - r_y)) + r_x result = m_x - else: # interpolation type is "smooth" - - ############################### # m_y is the one to be returned if (m_y == None): + + # linear interpolation if (interp_type == "linear"): m_y = (((r_y - l_y) / (r_x - l_x)) * (m_x - r_x)) + r_y result = m_y |