回答編集履歴

1

追記

2022/08/01 04:38

投稿

kazuma-s
kazuma-s

スコア8224

test CHANGED
@@ -17,4 +17,25 @@
17
17
 
18
18
  - right.drawData(x1, y1, L/Math.sqrt(2), a-Math.PI/4, g);
19
19
  + right.drawData(x1, y1, L/Math.sqrt(2), a-Math.PI/4, g, Color.cyan);
20
+ ```
21
+ **追記**
22
+ ```Java
23
+ data.drawData((double)getWidth()/2, (double)getHeight()/8,
24
+ (double)getWidth()/6, Math.PI/2, g, Color.white);//●●●(6)
20
25
 
26
+ void drawData(double x, double y, double L, double a, Graphics g, Color c) {
27
+ double x1 = x + L * Math.cos(a), y1 = y + L * Math.sin(a);
28
+ if (word.matches(".*")) {
29
+ g.setColor(c);
30
+ g.drawLine((int)Math.rint(x), (int)Math.rint(y),
31
+ (int)Math.rint(x1), (int)Math.rint(y1));
32
+ }
33
+ double t = Math.PI/6, L1 = L * 0.75; // ★ 6 や 0.75 は適当
34
+ if (left != null)
35
+ left.drawData(x1, y1, L1, a+t, g, Color.yellow);
36
+ if (right != null)
37
+ right.drawData(x1, y1, L1, a-t, g, Color.cyan);
38
+ }
39
+ }
40
+ ```
41
+ これでいいのかどうか、コメントをお願いします。