From af7f4d0b8ff803963f05291a3828d9dd57841ec5 Mon Sep 17 00:00:00 2001 From: guanjihuan Date: Fri, 28 Feb 2025 03:44:59 +0800 Subject: [PATCH] 0.1.156 --- PyPI/setup.cfg | 2 +- PyPI/src/guan.egg-info/PKG-INFO | 2 +- PyPI/src/guan/data_processing.py | 17 +++++++++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/PyPI/setup.cfg b/PyPI/setup.cfg index db1094b..d3d1908 100644 --- a/PyPI/setup.cfg +++ b/PyPI/setup.cfg @@ -1,7 +1,7 @@ [metadata] # replace with your username: name = guan -version = 0.1.155 +version = 0.1.156 author = guanjihuan author_email = guanjihuan@163.com description = An open source python package diff --git a/PyPI/src/guan.egg-info/PKG-INFO b/PyPI/src/guan.egg-info/PKG-INFO index 0a284f2..d38e417 100644 --- a/PyPI/src/guan.egg-info/PKG-INFO +++ b/PyPI/src/guan.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 2.2 Name: guan -Version: 0.1.155 +Version: 0.1.156 Summary: An open source python package Home-page: https://py.guanjihuan.com Author: guanjihuan diff --git a/PyPI/src/guan/data_processing.py b/PyPI/src/guan/data_processing.py index 774719e..cbfe026 100644 --- a/PyPI/src/guan/data_processing.py +++ b/PyPI/src/guan/data_processing.py @@ -96,6 +96,23 @@ def dimension_of_array(array): dim = array.shape[0] return dim +# 获取旋转矩阵(输入为角度) +def get_rotation_matrix(angle_deg): + import numpy as np + angle_rad = np.radians(angle_deg) + matrix = np.array([ + [np.cos(angle_rad), -np.sin(angle_rad)], + [np.sin(angle_rad), np.cos(angle_rad)] + ]) + return matrix + +# 旋转某个点,返回新的点的坐标 +def rotate_point(x, y, angle_deg): + import numpy as np + rotation_matrix = get_rotation_matrix(angle_deg) + x, y = np.dot(rotation_matrix, np.array([x, y])) + return x, y + # CPU性能测试(十亿次循环的浮点加法运算的时间,约30秒左右) def cpu_test_with_addition(print_show=1): import time