/// <summary> /// 視点座標計算 /// </summary> /// <param name="angleH">視点角度(水平)</param> /// <param name="angleV">視点角度(垂直)</param> /// <param name="distance">中心点からの距離</param> /// <returns></returns> private OpenGL3D_Bean CaleLoatAtPos(float angleH, float angleV, float distance) { OpenGL3D_Bean result = new OpenGL3D_Bean(); try { // 垂直方向 result.Y = (float)(distance * Math.Sin(angleV * 3.1415 / 180f)); float syaH = (float)(distance * Math.Cos(angleV * 3.1415 / 180f)); // 水平方向座標 if (Math.Abs(angleH) < 90 || (Math.Abs(angleH) >= 180 && Math.Abs(angleH) < 270)) { // 0~90度 result.X = (float)(syaH * Math.Cos(angleH * 3.1415 / 180f)); result.Z = (float)(syaH * Math.Cos((90 - angleH) * 3.1415 / 180f)); } else //if (Math.Abs(angleH) < 180) { // 90~180度 result.Z = (float)(syaH * Math.Cos((angleH - 90) * 3.1415 / 180f)); result.X = -(float)(syaH * Math.Cos((180 - angleH) * 3.1415 / 180f)); } } catch (Exception ex) { Tracer.WriteError("視点座標計算中にエラー発生 メッセージ {0} \r\n{1}", ex.Message.ToString(), ex.StackTrace.ToString()); } return(result); }
/// <summary> /// 各アイテム最大値取得 /// </summary> /// <param name="sorData">比較データ</param> public void CompItemMaxValue(OpenGL3D_Bean sorData) { if (this.x < sorData.X) { this.x = sorData.X; } if (this.y < sorData.Y) { this.y = sorData.Y; } if (this.z < sorData.Z) { this.z = sorData.Z; } }
/// <summary> /// 各アイテム最小値取得 /// </summary> /// <param name="sorData">比較データ</param> public void CompItemMinValue(OpenGL3D_Bean sorData) { if (this.x > sorData.X) { this.x = sorData.X; } if (this.y > sorData.Y) { this.y = sorData.Y; } if (this.z > sorData.Z) { this.z = sorData.Z; } }
/// <summary> /// コピー /// </summary> /// <param name="sorData">コピー元データ</param> public void Copy(OpenGL3D_Bean sorData) { this.x = sorData.X; this.y = sorData.Y; this.z = sorData.Z; }
/// <summary> /// 初期データ設定 /// </summary> protected override void SetInitData() { try { int data = 1; if (sensHoko == SENS_HOKOU.GYAKU_HOKO) { data = -1; } // センサー本体座標 OpenGL3D_Bean pointVC0 = new OpenGL3D_Bean(0.25f, 0.05f, 0.50f); OpenGL3D_Bean pointVC1 = new OpenGL3D_Bean(0.25f, 0.05f, -0.50f); OpenGL3D_Bean pointVC2 = new OpenGL3D_Bean(-0.25f, 0.05f, -0.50f); OpenGL3D_Bean pointVC3 = new OpenGL3D_Bean(-0.25f, 0.05f, 0.50f); OpenGL3D_Bean pointVC4 = new OpenGL3D_Bean(0.25f, -0.05f, 0.50f); OpenGL3D_Bean pointVC5 = new OpenGL3D_Bean(0.25f, -0.05f, -0.50f); OpenGL3D_Bean pointVC6 = new OpenGL3D_Bean(-0.25f, -0.05f, -0.50f); OpenGL3D_Bean pointVC7 = new OpenGL3D_Bean(-0.25f, -0.05f, 0.50f); // センサー方向表示用三角 //OpenGL3D_Bean pointVT0 = new OpenGL3D_Bean(0.00f * data, 0.051f, 0.45f * data); //OpenGL3D_Bean pointVT1 = new OpenGL3D_Bean(0.20f * data, 0.051f, -0.25f * data); //OpenGL3D_Bean pointVT2 = new OpenGL3D_Bean(-0.20f * data, 0.051f, -0.25f * data); //OpenGL3D_Bean pointVT3 = new OpenGL3D_Bean(0.00f * data, -0.051f, 0.45f * data); //OpenGL3D_Bean pointVT4 = new OpenGL3D_Bean(0.20f * data, -0.051f, -0.25f * data); //OpenGL3D_Bean pointVT5 = new OpenGL3D_Bean(-0.20f * data, -0.051f, -0.25f * data); OpenGL3D_Bean pointVT0 = new OpenGL3D_Bean(0.00f * data, 0.051f, -0.25f * data); OpenGL3D_Bean pointVT1 = new OpenGL3D_Bean(0.20f * data, 0.051f, 0.45f * data); OpenGL3D_Bean pointVT2 = new OpenGL3D_Bean(-0.20f * data, 0.051f, 0.45f * data); OpenGL3D_Bean pointVT3 = new OpenGL3D_Bean(0.00f * data, -0.051f, -0.25f * data); OpenGL3D_Bean pointVT4 = new OpenGL3D_Bean(0.20f * data, -0.051f, 0.45f * data); OpenGL3D_Bean pointVT5 = new OpenGL3D_Bean(-0.20f * data, -0.051f, 0.45f * data); // センサー本体座標 // VC0-VC1-VC2-VC3 SensVerInfoListConta.AddItem(new VertexInfo_Bean(pointVC0.X, pointVC0.Y, pointVC0.Z, 0f, 1f, 0f, 0.7f, 0.7f, 0.7f, 1f), true); SensVerInfoListConta.AddItem(new VertexInfo_Bean(pointVC1.X, pointVC1.Y, pointVC1.Z, 0f, 1f, 0f, 0.7f, 0.7f, 0.7f, 1f), false); SensVerInfoListConta.AddItem(new VertexInfo_Bean(pointVC2.X, pointVC2.Y, pointVC2.Z, 0f, 1f, 0f, 0.7f, 0.7f, 0.7f, 1f), false); SensVerInfoListConta.AddItem(new VertexInfo_Bean(pointVC3.X, pointVC3.Y, pointVC3.Z, 0f, 1f, 0f, 0.7f, 0.7f, 0.7f, 1f), false); // VC0-VC1-VC5-VC4 SensVerInfoListConta.AddItem(new VertexInfo_Bean(pointVC0.X, pointVC0.Y, pointVC0.Z, 1f, 0f, 0f, 0.7f, 0.7f, 0.7f, 1f), false); SensVerInfoListConta.AddItem(new VertexInfo_Bean(pointVC1.X, pointVC1.Y, pointVC1.Z, 1f, 0f, 0f, 0.7f, 0.7f, 0.7f, 1f), false); SensVerInfoListConta.AddItem(new VertexInfo_Bean(pointVC5.X, pointVC5.Y, pointVC2.Z, 1f, 0f, 0f, 0.7f, 0.7f, 0.7f, 1f), false); SensVerInfoListConta.AddItem(new VertexInfo_Bean(pointVC4.X, pointVC4.Y, pointVC3.Z, 1f, 0f, 0f, 0.7f, 0.7f, 0.7f, 1f), false); // VC1-VC2-VC6-VC5 SensVerInfoListConta.AddItem(new VertexInfo_Bean(pointVC1.X, pointVC1.Y, pointVC1.Z, 0f, 0f, -1f, 0.7f, 0.7f, 0.7f, 1f), false); SensVerInfoListConta.AddItem(new VertexInfo_Bean(pointVC2.X, pointVC2.Y, pointVC2.Z, 0f, 0f, -1f, 0.7f, 0.7f, 0.7f, 1f), false); SensVerInfoListConta.AddItem(new VertexInfo_Bean(pointVC6.X, pointVC6.Y, pointVC6.Z, 0f, 0f, -1f, 0.7f, 0.7f, 0.7f, 1f), false); SensVerInfoListConta.AddItem(new VertexInfo_Bean(pointVC5.X, pointVC5.Y, pointVC5.Z, 0f, 0f, -1f, 0.7f, 0.7f, 0.7f, 1f), false); // VC2-VC3-VC7-VC6 SensVerInfoListConta.AddItem(new VertexInfo_Bean(pointVC2.X, pointVC2.Y, pointVC2.Z, -1f, 0f, 0f, 0.7f, 0.7f, 0.7f, 1f), false); SensVerInfoListConta.AddItem(new VertexInfo_Bean(pointVC3.X, pointVC3.Y, pointVC3.Z, -1f, 0f, 0f, 0.7f, 0.7f, 0.7f, 1f), false); SensVerInfoListConta.AddItem(new VertexInfo_Bean(pointVC7.X, pointVC7.Y, pointVC7.Z, -1f, 0f, 0f, 0.7f, 0.7f, 0.7f, 1f), false); SensVerInfoListConta.AddItem(new VertexInfo_Bean(pointVC6.X, pointVC6.Y, pointVC6.Z, -1f, 0f, 0f, 0.7f, 0.7f, 0.7f, 1f), false); // VC0-VC3-VC7-VC4 SensVerInfoListConta.AddItem(new VertexInfo_Bean(pointVC0.X, pointVC0.Y, pointVC3.Z, 0f, 0f, 1f, 0.7f, 0.7f, 0.7f, 1f), false); SensVerInfoListConta.AddItem(new VertexInfo_Bean(pointVC3.X, pointVC3.Y, pointVC4.Z, 0f, 0f, 1f, 0.7f, 0.7f, 0.7f, 1f), false); SensVerInfoListConta.AddItem(new VertexInfo_Bean(pointVC7.X, pointVC7.Y, pointVC7.Z, 0f, 0f, 1f, 0.7f, 0.7f, 0.7f, 1f), false); SensVerInfoListConta.AddItem(new VertexInfo_Bean(pointVC4.X, pointVC4.Y, pointVC6.Z, 0f, 0f, 1f, 0.7f, 0.7f, 0.7f, 1f), false); // VC4-VC5-VC6-VC7 SensVerInfoListConta.AddItem(new VertexInfo_Bean(pointVC4.X, pointVC4.Y, pointVC4.Z, 0f, -1f, 0f, 0.7f, 0.7f, 0.7f, 1f), false); SensVerInfoListConta.AddItem(new VertexInfo_Bean(pointVC5.X, pointVC5.Y, pointVC5.Z, 0f, -1f, 0f, 0.7f, 0.7f, 0.7f, 1f), false); SensVerInfoListConta.AddItem(new VertexInfo_Bean(pointVC6.X, pointVC6.Y, pointVC6.Z, 0f, -1f, 0f, 0.7f, 0.7f, 0.7f, 1f), false); SensVerInfoListConta.AddItem(new VertexInfo_Bean(pointVC7.X, pointVC7.Y, pointVC7.Z, 0f, -1f, 0f, 0.7f, 0.7f, 0.7f, 1f), false); SensVerInfoListConta.SeVertexNoList(new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 }, true); // センサー方向表示用三角 //VT0-VT1-VT2 SensHokoVerInfoListConta.AddItem(new VertexInfo_Bean(pointVT0.X, pointVT0.Y, pointVT0.Z, 0f, 1f, 0f, 0.7f, 0.3f, 0.3f, 1f), true); SensHokoVerInfoListConta.AddItem(new VertexInfo_Bean(pointVT1.X, pointVT1.Y, pointVT1.Z, 0f, 1f, 0f, 0.7f, 0.3f, 0.3f, 1f), false); SensHokoVerInfoListConta.AddItem(new VertexInfo_Bean(pointVT2.X, pointVT2.Y, pointVT2.Z, 0f, 1f, 0f, 0.7f, 0.3f, 0.3f, 1f), false); //VT3-VT4-VT5 SensHokoVerInfoListConta.AddItem(new VertexInfo_Bean(pointVT3.X, pointVT3.Y, pointVT3.Z, 0f, 1f, 0f, 0.3f, 0.3f, 0.5f, 1f), false); SensHokoVerInfoListConta.AddItem(new VertexInfo_Bean(pointVT4.X, pointVT4.Y, pointVT4.Z, 0f, 1f, 0f, 0.3f, 0.3f, 0.5f, 1f), false); SensHokoVerInfoListConta.AddItem(new VertexInfo_Bean(pointVT5.X, pointVT5.Y, pointVT5.Z, 0f, 1f, 0f, 0.3f, 0.3f, 0.5f, 1f), false); SensHokoVerInfoListConta.SeVertexNoList(new int[] { 0, 1, 2, 3, 4, 5 }, true); // 描画パラメータ初期値設定 GraphLockAtAngleH = 70; GraphLockAtAngleV = 30; GraphLockAtDistance = 2; } catch (Exception ex) { Tracer.WriteError("初期データ設定中にエラー発生 メッセージ {0} \r\n{1}", ex.Message.ToString(), ex.StackTrace.ToString()); } }