回答編集履歴

3

追記

2017/07/23 17:10

投稿

LouiS0616
LouiS0616

スコア35660

test CHANGED
@@ -52,6 +52,36 @@
52
52
 
53
53
 
54
54
 
55
+ ---
56
+
57
+ 試してないですが、こうすれば比率指定も出来そうですね。
58
+
59
+ ```Python
60
+
61
+ def get_rect_by_ratio(x_ratio_range, y_ratio_range):
62
+
63
+ left_up = {'x': x_ratio_range['len'] * x_ratio_range['from'],
64
+
65
+ 'y': y_ratio_range['len'] * y_ratio_range['from']}
66
+
67
+ right_down = {'x': x_ratio_range['len'] * x_ratio_range['to'],
68
+
69
+ 'y': y_ratio_range['len'] * y_ratio_range['to']}
70
+
71
+
72
+
73
+ return get_rect(left_up, right_down)
74
+
75
+ ```
76
+
77
+
78
+
79
+ `x_ratio_range`に与えるのは、`{'len': x_len, 'from': 1/2, 'to': 1}`ってイメージです。
80
+
81
+ ちょっと改造すれば何分割でも出来そうです。
82
+
83
+
84
+
55
85
  ...もっといい方法があるような気もします。
56
86
 
57
87
 

2

成形

2017/07/23 17:10

投稿

LouiS0616
LouiS0616

スコア35660

test CHANGED
@@ -1,6 +1,8 @@
1
1
  尋常じゃない醜さですが、適当に作ってみました。
2
2
 
3
3
  ```Python
4
+
5
+ # 勝手に名前変えちゃいました。
4
6
 
5
7
  def quartering_map(map):
6
8
 
@@ -42,6 +44,8 @@
42
44
 
43
45
  get_rect({'x': x_middle, 'y': y_middle}, {'x': x_len, 'y': y_len})
44
46
 
47
+
48
+
45
49
  return upper_right_map, upper_left_map, under_right_map, under_left_map
46
50
 
47
51
  ```

1

追記

2017/07/23 17:00

投稿

LouiS0616
LouiS0616

スコア35660

test CHANGED
@@ -49,3 +49,9 @@
49
49
 
50
50
 
51
51
  ...もっといい方法があるような気もします。
52
+
53
+
54
+
55
+ ---
56
+
57
+ 文字通り「座標」をリストにしましたが、これでいいんですかね。