回答編集履歴
2
コードの修正
test
CHANGED
@@ -38,7 +38,7 @@
|
|
38
38
|
|
39
39
|
|
40
40
|
|
41
|
-
blenderでも同じような機能として `bpy.ops.mesh.primitive_
|
41
|
+
blenderでも同じような機能として `bpy.ops.mesh.primitive_uv_sphere_add` があるので、これを利用して
|
42
42
|
|
43
43
|
```
|
44
44
|
|
@@ -68,7 +68,7 @@
|
|
68
68
|
|
69
69
|
z2 = (rr) * math.cos(nn * math.pi/180)
|
70
70
|
|
71
|
-
bpy.ops.mesh.primitive_
|
71
|
+
bpy.ops.mesh.primitive_uv_sphere_add(location=(x2, y2, z2), size=0.6)
|
72
72
|
|
73
73
|
```
|
74
74
|
|
1
回答の追記
test
CHANGED
@@ -23,3 +23,53 @@
|
|
23
23
|
※前の質問にも記載しましたが、コードはマークダウン記法で書くと見やすくなります。
|
24
24
|
|
25
25
|
※質問文は編集できるので、削除せず修正してください。
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
【追記】
|
30
|
+
|
31
|
+
参考サイトでは、メビウスの輪の各サンプリング座標を計算し、最終的に x2, y2, z2 という座標を求めています。その座標に下記の関数で球体オブジェクトを次々に配置している形となります。
|
32
|
+
|
33
|
+
```
|
34
|
+
|
35
|
+
scene.create_sphere(None,(x2, y2, z2),0.6)
|
36
|
+
|
37
|
+
```
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
blenderでも同じような機能として `bpy.ops.mesh.primitive_ico_sphere_add` があるので、これを利用して
|
42
|
+
|
43
|
+
```
|
44
|
+
|
45
|
+
import bpy
|
46
|
+
|
47
|
+
import math
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
r = 10
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
for n in range(0,360,3):
|
56
|
+
|
57
|
+
for rr in [-1.5,-1.2, -0.9, -0.6, -0.3, 0.0, 0.3, 0.6, 0.9, 1.2,1.5]:
|
58
|
+
|
59
|
+
nn = n / 2
|
60
|
+
|
61
|
+
x1 = (r) * math.cos(n * math.pi/180)
|
62
|
+
|
63
|
+
y1 = (r) * math.sin(n * math.pi/180)
|
64
|
+
|
65
|
+
x2 = x1 + (rr) * math.sin(nn * math.pi/180) * math.cos(n * math.pi/180)
|
66
|
+
|
67
|
+
y2 = y1 + (rr) * math.sin(nn * math.pi/180) * math.sin(n * math.pi/180)
|
68
|
+
|
69
|
+
z2 = (rr) * math.cos(nn * math.pi/180)
|
70
|
+
|
71
|
+
bpy.ops.mesh.primitive_ico_sphere_add(location=(x2, y2, z2), size=0.6)
|
72
|
+
|
73
|
+
```
|
74
|
+
|
75
|
+
上記のコードでおおよそ同じ結果が得られるかと思います。
|