plunkerでthree.js その4

# 概要
plunkerでthree.jsやってみた。
練習問題やってみた。

# 練習問題
モデリング言語で、トーラスを作れ。

# 写真

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/18104/5e14991e-92fe-c83b-2365-43b4f3c026c3.png)

# サンプルコード

```
process.stdin.resume();
process.stdin.setEncoding('utf8');


var r = 10;
var n2 = 5;
var n3 = n2 + 1;
var n4 = n2 + 2;
var n5 = n2 + 3;
for (let j = 0; j < n4; j++)
{
	let d = Math.sin((j / n3) * Math.PI * 2) + 10
	let y = Math.cos((j / n3) * Math.PI * 2) * r 
	for (let i = 0; i < n4; i++)
	{
		let x = Math.cos((i / n3) * Math.PI * 2) * r * d
		let z = Math.sin((i / n3) * Math.PI * 2) * r * d
        console.log("p", x, y, z);
	}
}
for (let j = 0; j < n3; j++)
{
	for (let i = 0; i < n4; i++)
	{
		var b = i + j * n4 + 1;
		if (b == 42) 
		    n5 = n4;
		console.log("s", b, b +  1, b + n4, b + n5);
	}
}
```

# 実行結果

```
p 100 10 0
p 50.00000000000001 10 86.60254037844385
p -49.999999999999986 10 86.60254037844388
p -100 10 1.2246467991473532e-14
p -50.00000000000004 10 -86.60254037844385
p 50.00000000000001 10 -86.60254037844385
p 100 10 -2.4492935982947064e-14
p 108.6602540378444 5.000000000000001 0
p 54.330127018922205 5.000000000000001 94.10254037844386
p -54.33012701892218 5.000000000000001 94.10254037844388
p -108.6602540378444 5.000000000000001 1.330704323019844e-14
p -54.33012701892225 5.000000000000001 -94.10254037844386
p 54.330127018922205 5.000000000000001 -94.10254037844386
p 108.6602540378444 5.000000000000001 -2.661408646039688e-14
p 108.6602540378444 -4.999999999999998 0
p 54.330127018922205 -4.999999999999998 94.10254037844386
p -54.33012701892218 -4.999999999999998 94.10254037844388
p -108.6602540378444 -4.999999999999998 1.330704323019844e-14
p -54.33012701892225 -4.999999999999998 -94.10254037844386
p 54.330127018922205 -4.999999999999998 -94.10254037844386
p 108.6602540378444 -4.999999999999998 -2.661408646039688e-14
p 100 -10 0
p 50.00000000000001 -10 86.60254037844385
p -49.999999999999986 -10 86.60254037844388
p -100 -10 1.2246467991473532e-14
p -50.00000000000004 -10 -86.60254037844385
p 50.00000000000001 -10 -86.60254037844385
p 100 -10 -2.4492935982947064e-14
p 91.3397459621556 -5.000000000000004 0
p 45.66987298107781 -5.000000000000004 79.10254037844385
p -45.66987298107779 -5.000000000000004 79.10254037844386
p -91.3397459621556 -5.000000000000004 1.1185892752748625e-14
p -45.669872981077845 -5.000000000000004 -79.10254037844385
p 45.66987298107781 -5.000000000000004 -79.10254037844385
p 91.3397459621556 -5.000000000000004 -2.237178550549725e-14
p 91.3397459621556 5.000000000000001 0
p 45.66987298107781 5.000000000000001 79.10254037844385
p -45.66987298107779 5.000000000000001 79.10254037844386
p -91.3397459621556 5.000000000000001 1.1185892752748625e-14
p -45.669872981077845 5.000000000000001 -79.10254037844385
p 45.66987298107781 5.000000000000001 -79.10254037844385
p 91.3397459621556 5.000000000000001 -2.237178550549725e-14
p 100 10 0
p 50.00000000000001 10 86.60254037844385
p -49.999999999999986 10 86.60254037844388
p -100 10 1.2246467991473532e-14
p -50.00000000000004 10 -86.60254037844385
p 50.00000000000001 10 -86.60254037844385
p 100 10 -2.4492935982947064e-14
s 1 2 8 9
s 2 3 9 10
s 3 4 10 11
s 4 5 11 12
s 5 6 12 13
s 6 7 13 14
s 7 8 14 15
s 8 9 15 16
s 9 10 16 17
s 10 11 17 18
s 11 12 18 19
s 12 13 19 20
s 13 14 20 21
s 14 15 21 22
s 15 16 22 23
s 16 17 23 24
s 17 18 24 25
s 18 19 25 26
s 19 20 26 27
s 20 21 27 28
s 21 22 28 29
s 22 23 29 30
s 23 24 30 31
s 24 25 31 32
s 25 26 32 33
s 26 27 33 34
s 27 28 34 35
s 28 29 35 36
s 29 30 36 37
s 30 31 37 38
s 31 32 38 39
s 32 33 39 40
s 33 34 40 41
s 34 35 41 42
s 35 36 42 43
s 36 37 43 44
s 37 38 44 45
s 38 39 45 46
s 39 40 46 47
s 40 41 47 48
s 41 42 48 49
s 42 43 49 49
```

# 成果物

https://paiza.io/projects/FIfK5IAMSIY4eg1SBq64Hg


以上。