From 4ed6f9dc3449a5e4b73b81af94ab2a493653b8a4 Mon Sep 17 00:00:00 2001 From: Casey_Nelson <91818705+CaseyNelson314@users.noreply.github.com> Date: Sat, 23 Dec 2023 11:56:29 +0900 Subject: [PATCH] =?UTF-8?q?=E9=9B=BB=E6=B0=97=E5=8A=9B=E7=B7=9A=E3=81=8C?= =?UTF-8?q?=E7=82=B9=E9=9B=BB=E8=8D=B7=E3=81=AE=E8=A1=A8=E9=9D=A2=E3=81=8B?= =?UTF-8?q?=E3=82=89=E5=9D=87=E4=B8=80=E3=81=AB=E5=87=BA=E3=82=8B=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/script/main.js | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/app/script/main.js b/app/script/main.js index 78353fa..cf931e3 100644 --- a/app/script/main.js +++ b/app/script/main.js @@ -98,24 +98,26 @@ const CreateElectricLineGeometry = (origin_charge, vector, point_charges, length const line_material = new THREE.LineBasicMaterial({ color: 0x0000ff }); for (const point_charge of point_charges) { - for (var i = 0; i < 100; i++) { - // 球面上に点を打つ - const theta = Math.random() * Math.PI * 2; - const phi = Math.random() * Math.PI * 2; - const x = 5 * Math.sin(theta) * Math.cos(phi); - const y = 5 * Math.sin(theta) * Math.sin(phi); - const z = 5 * Math.cos(theta); - - const line = new THREE.Line( - CreateElectricLineGeometry( - point_charge, - new THREE.Vector3(x, y, z), - point_charges, - 500 - ), - line_material - ); - scene.add(line); + + for (var n_theta = 0; n_theta < 10; n_theta++) { + for (var n_phi = 0; n_phi < 10; n_phi++) { + const theta = (Math.PI * 2) / 10 * n_theta; + const phi = (Math.PI * 2) / 10 * n_phi; + const x = 5 * Math.sin(theta) * Math.cos(phi); + const y = 5 * Math.sin(theta) * Math.sin(phi); + const z = 5 * Math.cos(theta); + + const line = new THREE.Line( + CreateElectricLineGeometry( + point_charge, + new THREE.Vector3(x, y, z), + point_charges, + 500 + ), + line_material + ); + scene.add(line); + } } // for (var x = -5; x <= 5; x++) { // for (var y = -5; y <= 5; y++) {