# include // OpenSiv3D v0.6.10 #include "MyFunction.h" void Main() { // 背景の色を設定する | Set the background color Scene::SetBackground(ColorF{ 0.6, 0.8, 0.7 }); triangle t; SetEquTrianglePoint(t, 300); Vec2 cp; Vec2 res; while (System::Update()) { if (MouseL.pressed()) { cp = Cursor::Pos(); Print << cp << U", " << ConvertScreen2Math(cp); res = GetShortestPoint(t, ConvertScreen2Math(cp)); Circle{ ConvertMath2Screen(res), 20 }.draw(Palette::Yellow); } DrawAxis(); Triangle{ ConvertMath2Screen(t.pos[0]), ConvertMath2Screen(t.pos[1]), ConvertMath2Screen(t.pos[2]) } .draw({ Palette::Orangered, 0.8 }); } //座標軸を画面の中心を原点として描画(数学座標と、スクリーン座標の変換) //原点を重心とした3角形を書く(正三角形がいいなぁ) //画面をクリックしたときに、一番近い頂点をCircleで光らせる(色を変えて目立たせる) }