-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
54 lines (47 loc) · 2.19 KB
/
main.py
File metadata and controls
54 lines (47 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import sys
from PySide6.QtWidgets import QApplication
from UI.main_window import MainWindow
from Core.data_model import Model, Face, Vertex
from Service.selection_manager import SelectionManager
def main():
app = QApplication(sys.argv)
# 唯一のモデルインスタンスを生成
model = Model()
# 選択状態管理マネージャの生成
selection_manager = SelectionManager()
# 初期データの投入: 原点に1つの立方体の面を追加 (テスト用)
# @intent:rationale 現状のプロトタイプでは、頂点インスタンスは面ごとに独立して生成されており、共有されていない。
# これは最もシンプルな実装だが、トポロジー情報(どの頂点がどの面と隣接しているか)が失われる。
# このため、頂点単位でのスムーズな変形(例:1つの角を動かすと隣接する面が追従する)はできない。
# この制約を回避しオブジェクト全体を操作するため、UI側に「Object Mode」が導入された。
# 将来的な機能拡張(頂点編集など)の際には、頂点共有(Vertex Pool)の導入を検討する必要がある。
# 前面
model.add_face(Face([
Vertex(-1, -1, 1), Vertex(1, -1, 1), Vertex(1, 1, 1), Vertex(-1, 1, 1)
], "front"))
# 背面
model.add_face(Face([
Vertex(1, -1, -1), Vertex(-1, -1, -1), Vertex(-1, 1, -1), Vertex(1, 1, -1)
], "back"))
# 上面
model.add_face(Face([
Vertex(-1, 1, 1), Vertex(1, 1, 1), Vertex(1, 1, -1), Vertex(-1, 1, -1)
], "top"))
# 下面
model.add_face(Face([
Vertex(-1, -1, -1), Vertex(1, -1, -1), Vertex(1, -1, 1), Vertex(-1, -1, 1)
], "bottom"))
# 右面
model.add_face(Face([
Vertex(1, -1, 1), Vertex(1, -1, -1), Vertex(1, 1, -1), Vertex(1, 1, 1)
], "right"))
# 左面
model.add_face(Face([
Vertex(-1, -1, -1), Vertex(-1, -1, 1), Vertex(-1, 1, 1), Vertex(-1, 1, -1)
], "left"))
# メインウィンドウの作成と表示
window = MainWindow(model, selection_manager)
window.show()
sys.exit(app.exec())
if __name__ == "__main__":
main()