回答編集履歴

1

Update

2021/12/25 23:43

投稿

melian
melian

スコア19912

test CHANGED
@@ -76,7 +76,11 @@
76
76
 
77
77
  if not self.pc:
78
78
 
79
+ self.pc = np.array([
80
+
79
- self.pc = [[Vector3D() for _ in range(ncols)] for _ in range(nrows)]
81
+ [Vector3D() for _ in range(ncols)] for _ in range(nrows)
82
+
83
+ ], dtype=object)
80
84
 
81
85
 
82
86
 
@@ -90,15 +94,15 @@
90
94
 
91
95
  arr_pc[0].resize(2, 3)
92
96
 
93
- arr_pc[0][1][2].X = 100.0
97
+ arr_pc[0][1,2].X = 100.0
94
98
 
95
- pprint(arr_pc[0][1][2].X)
99
+ pprint(arr_pc[0][1,2].X)
96
100
 
97
101
 
98
102
 
99
103
  pprint(type(arr_pc[0]))
100
104
 
101
- pprint(type(arr_pc[0][0][0]))
105
+ pprint(type(arr_pc[0][0,0]))
102
106
 
103
107
  pprint(arr_pc[0][:])
104
108
 
@@ -112,16 +116,18 @@
112
116
 
113
117
  <class '__main__.Vector3D'>
114
118
 
115
- [[Vector3D((0., 0., 0.), dtype=[('X', '<f8'), ('Y', '<f8'), ('Z', '<f8')]),
119
+ array([[Vector3D((0., 0., 0.), dtype=[('X', '<f8'), ('Y', '<f8'), ('Z', '<f8')]),
116
120
 
117
- Vector3D((0., 0., 0.), dtype=[('X', '<f8'), ('Y', '<f8'), ('Z', '<f8')]),
121
+ Vector3D((0., 0., 0.), dtype=[('X', '<f8'), ('Y', '<f8'), ('Z', '<f8')]),
118
122
 
119
- Vector3D((0., 0., 0.), dtype=[('X', '<f8'), ('Y', '<f8'), ('Z', '<f8')])],
123
+ Vector3D((0., 0., 0.), dtype=[('X', '<f8'), ('Y', '<f8'), ('Z', '<f8')])],
120
124
 
121
- [Vector3D((0., 0., 0.), dtype=[('X', '<f8'), ('Y', '<f8'), ('Z', '<f8')]),
125
+ [Vector3D((0., 0., 0.), dtype=[('X', '<f8'), ('Y', '<f8'), ('Z', '<f8')]),
122
126
 
123
- Vector3D((0., 0., 0.), dtype=[('X', '<f8'), ('Y', '<f8'), ('Z', '<f8')]),
127
+ Vector3D((0., 0., 0.), dtype=[('X', '<f8'), ('Y', '<f8'), ('Z', '<f8')]),
124
128
 
125
- Vector3D((100., 0., 0.), dtype=[('X', '<f8'), ('Y', '<f8'), ('Z', '<f8')])]]
129
+ Vector3D((100., 0., 0.), dtype=[('X', '<f8'), ('Y', '<f8'), ('Z', '<f8')])]],
130
+
131
+ dtype=object)
126
132
 
127
133
  ```