This commit is contained in:
guanjihuan 2025-02-28 03:44:59 +08:00
parent 9660bd6fc6
commit af7f4d0b8f
3 changed files with 19 additions and 2 deletions

View File

@ -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

View File

@ -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

View File

@ -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