cprdspy 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of cprdspy might be problematic. Click here for more details.

Files changed (46) hide show
  1. cprdspy/CPR_3D/shpere.py +72 -0
  2. cprdspy/CPR_3D/shperical_surface.py +72 -0
  3. cprdspy/CPR_3D/test.py +76 -0
  4. cprdspy/CPR_3D/utills.py +21 -0
  5. cprdspy/CPR_Dashborad/CPRSP.py +1663 -0
  6. cprdspy/CPR_Dashborad/app.py +627 -0
  7. cprdspy/CPR_matplotlib/CirclePointRoundSourcePure.py +1011 -0
  8. cprdspy/CPR_matplotlib/__init__.py +0 -0
  9. cprdspy/CPR_plotly/Arcs/__init__.py +0 -0
  10. cprdspy/CPR_plotly/Arcs/arc.py +183 -0
  11. cprdspy/CPR_plotly/Arcs/arc_config.py +699 -0
  12. cprdspy/CPR_plotly/CPRSP.py +1663 -0
  13. cprdspy/CPR_plotly/Circles/__init__.py +0 -0
  14. cprdspy/CPR_plotly/Circles/circle.py +154 -0
  15. cprdspy/CPR_plotly/Circles/circle1.py +154 -0
  16. cprdspy/CPR_plotly/Circles/circle_config.py +214 -0
  17. cprdspy/CPR_plotly/Dots/__init__.py +0 -0
  18. cprdspy/CPR_plotly/Dots/dot.py +113 -0
  19. cprdspy/CPR_plotly/Dots/dot_config.py +340 -0
  20. cprdspy/CPR_plotly/Flowers/__init__.py +0 -0
  21. cprdspy/CPR_plotly/Flowers/flower.py +536 -0
  22. cprdspy/CPR_plotly/Flowers/flower_config.py +640 -0
  23. cprdspy/CPR_plotly/Flowers/flower_config1.py +228 -0
  24. cprdspy/CPR_plotly/Flowers/flower_config2.py +323 -0
  25. cprdspy/CPR_plotly/Flowers/flower_config_.py +533 -0
  26. cprdspy/CPR_plotly/Flowers/tempCodeRunnerFile.py +10 -0
  27. cprdspy/CPR_plotly/Lines/__init__.py +0 -0
  28. cprdspy/CPR_plotly/Lines/line.py +399 -0
  29. cprdspy/CPR_plotly/Lines/line_config.py +466 -0
  30. cprdspy/CPR_plotly/Spirals/__init__.py +0 -0
  31. cprdspy/CPR_plotly/Spirals/spiral.py +141 -0
  32. cprdspy/CPR_plotly/Spirals/spiral_config.py +472 -0
  33. cprdspy/CPR_plotly/Stars/__init__.py +0 -0
  34. cprdspy/CPR_plotly/Stars/star.py +0 -0
  35. cprdspy/CPR_plotly/Stars/star_config.py +0 -0
  36. cprdspy/CPR_plotly/Waves/__init__.py +0 -0
  37. cprdspy/CPR_plotly/Waves/wave.py +146 -0
  38. cprdspy/CPR_plotly/Waves/wave_config.py +253 -0
  39. cprdspy/CPR_plotly/__init__.py +0 -0
  40. cprdspy/CPR_plotly/canvas.py +9 -0
  41. cprdspy/__init__.py +221 -0
  42. cprdspy/config.py +383 -0
  43. cprdspy-0.1.0.dist-info/METADATA +14 -0
  44. cprdspy-0.1.0.dist-info/RECORD +46 -0
  45. cprdspy-0.1.0.dist-info/WHEEL +5 -0
  46. cprdspy-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,72 @@
1
+ import plotly.graph_objects as go
2
+ import numpy as np
3
+
4
+ # 参数设置
5
+ R = 1.0 # 球体半径
6
+ transparency = 0.5 # 透明度(0-1)
7
+
8
+ # 生成球面网格点
9
+ theta = np.linspace(0, 2 * np.pi, 50) # 方位角
10
+ phi = np.linspace(0, np.pi, 25) # 极角
11
+ theta_grid, phi_grid = np.meshgrid(theta, phi)
12
+
13
+ # 转换为直角坐标
14
+ x = R * np.sin(phi_grid) * np.cos(theta_grid)
15
+ y = R * np.sin(phi_grid) * np.sin(theta_grid)
16
+ z = R * np.cos(phi_grid)
17
+
18
+ # 创建球体表面
19
+ sphere = go.Surface(
20
+ x=x,
21
+ y=y,
22
+ z=z,
23
+ colorscale=[[0, "blue"], [1, "blue"]],
24
+ opacity=transparency,
25
+ showscale=False,
26
+ )
27
+ # 转换为直角坐标
28
+ x1 = R * np.sin(phi_grid) * np.cos(theta_grid)
29
+ y1 = R * np.sin(phi_grid) * np.sin(theta_grid)
30
+ z1 = R * np.cos(phi_grid) - R
31
+
32
+ # 创建球体表面
33
+ sphere1 = go.Surface(
34
+ x=x1,
35
+ y=y1,
36
+ z=z1,
37
+ colorscale=[[0, "lime"], [1, "lime"]],
38
+ opacity=transparency,
39
+ showscale=False,
40
+ )
41
+
42
+ # 标记球心
43
+ center = go.Scatter3d(
44
+ x=[0], y=[0], z=[0], mode="markers", marker=dict(size=5, color="red"), name="球心"
45
+ )
46
+ center1 = go.Scatter3d(
47
+ x=[0],
48
+ y=[0],
49
+ z=[-1],
50
+ mode="markers",
51
+ marker=dict(size=5, color="green"),
52
+ name="球心1",
53
+ )
54
+
55
+ # 创建图形
56
+ fig = go.Figure(data=[sphere, center, sphere1, center1])
57
+
58
+ # 关键设置:强制等比例显示
59
+ fig.update_layout(
60
+ scene=dict(
61
+ xaxis=dict(range=[-R * 2, R * 2], nticks=5), # 设置轴范围略大于半径
62
+ yaxis=dict(range=[-R * 2, R * 2], nticks=5),
63
+ zaxis=dict(range=[-R * 2, R * 2], nticks=5),
64
+ aspectmode="manual", # 手动设置比例
65
+ aspectratio=dict(x=1, y=1, z=1), # 1:1:1比例
66
+ ),
67
+ width=700,
68
+ height=600,
69
+ title="透明正球体(完美比例)",
70
+ )
71
+
72
+ fig.show()
@@ -0,0 +1,72 @@
1
+ import plotly.graph_objects as go
2
+ import numpy as np
3
+
4
+
5
+ def spherical_surface(center, alpha, beta=0, R=1):
6
+ # 参数设置
7
+ theta = np.linspace(0, np.pi, 50) # 极角 θ ∈ [0, π](上下半球)
8
+ phi = np.linspace(alpha, beta, 50) # 方位角 φ ∈ [α, β]
9
+ # 生成网格
10
+ theta_grid, phi_grid = np.meshgrid(theta, phi)
11
+ # 转换为直角坐标系
12
+ x = R * np.sin(theta_grid) * np.cos(phi_grid) + center[0]
13
+ y = R * np.sin(theta_grid) * np.sin(phi_grid) + center[1]
14
+ z = R * np.cos(theta_grid) + center[2]
15
+ # 绘制曲面
16
+ fig = go.Figure(
17
+ data=[
18
+ go.Surface(x=x, y=y, z=z, colorscale="#0f0", opacity=0.8, showscale=False)
19
+ ]
20
+ )
21
+ # 添加辅助平面
22
+ x_bound0 = R * np.sin(theta) * np.cos(alpha) + center[0] # 边界
23
+ y_bound0 = R * np.sin(theta) * np.sin(alpha) + center[1]
24
+ z_bound0 = R * np.cos(theta) + center[2]
25
+ x_bound1 = R * np.sin(theta) * np.cos(beta) + center[0] # 边界
26
+ y_bound1 = R * np.sin(theta) * np.sin(beta) + center[1]
27
+ z_bound1 = R * np.cos(theta) + center[2]
28
+ fig.add_trace(
29
+ go.Scatter3d(
30
+ x=x_bound0,
31
+ y=y_bound0,
32
+ z=z_bound0,
33
+ mode="lines",
34
+ line=dict(color="red", width=5),
35
+ name="α=alpha",
36
+ )
37
+ )
38
+ fig.add_trace(
39
+ go.Scatter3d(
40
+ x=x_bound1,
41
+ y=y_bound1,
42
+ z=z_bound1,
43
+ mode="lines",
44
+ line=dict(color="blue", width=5),
45
+ name="β=beta",
46
+ )
47
+ )
48
+ return fig
49
+
50
+
51
+ surface = spherical_surface(
52
+ (0, np.sqrt(2) / 2, 0),
53
+ alpha=-np.arccos(np.sqrt(3 + 8 * np.sqrt(2)) * (4 * np.sqrt(2) - 1) / 18),
54
+ beta=0,
55
+ R=1,
56
+ )
57
+ # 设置布局
58
+ R = 1
59
+ surface.fig.update_layout(
60
+ title="球面坐标系中 φ ∈ [0, π/4] 的曲面",
61
+ scene=dict(
62
+ xaxis=dict(range=[-R * 2, R * 2], nticks=5), # 设置轴范围略大于半径
63
+ yaxis=dict(range=[-R * 2, R * 2], nticks=5),
64
+ zaxis=dict(range=[-R * 2, R * 2], nticks=5),
65
+ aspectmode="manual", # 手动设置比例
66
+ aspectratio=dict(x=1, y=1, z=1), # 1:1:1比例
67
+ ),
68
+ width=700,
69
+ height=700,
70
+ )
71
+
72
+ surface.fig.show()
cprdspy/CPR_3D/test.py ADDED
@@ -0,0 +1,76 @@
1
+ import plotly.graph_objects as go
2
+ import numpy as np
3
+
4
+ # 参数设置
5
+ R = 1.0 # 球体半径
6
+ n = 3
7
+ transparency = 0.5 # 透明度(0-1)
8
+
9
+
10
+ def n_points(N, R, theta_p=0):
11
+ return [
12
+ [
13
+ R * np.cos(i * 2 * np.pi / N + np.pi / 2 + theta_p),
14
+ R * np.sin(i * 2 * np.pi / N + np.pi / 2 + theta_p),
15
+ ]
16
+ for i in range(N)
17
+ ]
18
+
19
+
20
+ a = n_points(n, 1)
21
+
22
+ # 生成球面网格点
23
+ theta = np.linspace(0, 2 * np.pi, 50) # 方位角
24
+ phi = np.linspace(0, np.pi, 25) # 极角
25
+ theta_grid, phi_grid = np.meshgrid(theta, phi)
26
+
27
+ # 初始化列表
28
+ spheres = [] # 存储所有球体
29
+ centers = [] # 存储所有球心
30
+
31
+ for i in range(n):
32
+ # 转换为直角坐标
33
+ x = R * np.sin(phi_grid) * np.cos(theta_grid) + a[i][0]
34
+ y = R * np.sin(phi_grid) * np.sin(theta_grid) + a[i][1]
35
+ z = R * np.cos(phi_grid)
36
+
37
+ # 创建球体表面
38
+ sphere = go.Surface(
39
+ x=x,
40
+ y=y,
41
+ z=z,
42
+ colorscale=[[0, "blue"], [1, "blue"]],
43
+ opacity=transparency,
44
+ showscale=False,
45
+ )
46
+ spheres.append(sphere)
47
+
48
+ # 标记球心
49
+ center = go.Scatter3d(
50
+ x=[a[i][0]], # 需要传入列表
51
+ y=[a[i][1]], # 需要传入列表
52
+ z=[0],
53
+ mode="markers",
54
+ marker=dict(size=5, color="red"),
55
+ name=f"球心 {i+1}", # 为每个球心添加编号
56
+ )
57
+ centers.append(center)
58
+
59
+ # 创建图形,合并所有数据
60
+ fig = go.Figure(data=spheres + centers)
61
+
62
+ # 关键设置:强制等比例显示
63
+ fig.update_layout(
64
+ scene=dict(
65
+ xaxis=dict(range=[-R * 2, R * 2], nticks=5), # 设置轴范围略大于半径
66
+ yaxis=dict(range=[-R * 2, R * 2], nticks=5),
67
+ zaxis=dict(range=[-R * 2, R * 2], nticks=5),
68
+ aspectmode="manual", # 手动设置比例
69
+ aspectratio=dict(x=1, y=1, z=1), # 1:1:1比例
70
+ ),
71
+ width=700,
72
+ height=600,
73
+ title="透明正球体(完美比例)",
74
+ )
75
+
76
+ fig.show()
@@ -0,0 +1,21 @@
1
+ import numpy as np
2
+ import plotly.graph_objects as go
3
+
4
+ # 参数设置
5
+ R = 1.0 # 球体半径
6
+ transparency = 0.5 # 透明度(0-1)
7
+
8
+
9
+ # 生成半径R圆上均匀N等分点
10
+ def n_points(N, R, theta_p=0):
11
+ return [
12
+ [
13
+ R * np.cos(i * 2 * np.pi / N + np.pi / 2 + theta_p),
14
+ R * np.sin(i * 2 * np.pi / N + np.pi / 2 + theta_p),
15
+ ]
16
+ for i in range(N)
17
+ ]
18
+
19
+
20
+ a = n_points(3, 1)
21
+ print(a)