public string ToString(DispFormat dFrmt) { switch (dFrmt) { case DispFormat.Long: return(HasValue? string.Format( "{0:d MMM yyyy HH:'00'} Utc: " + "{1:d MMM yyyy HH:'00'} PPT", StartUtc, StartPvt): "Interval Null"); case DispFormat.HE: return(HasValue? string.Format( "{0:d MMM yy} {1} PPT", StartPvt, HE): "Interval Null"); case DispFormat.HE25: return(HasValue ? string.Format( "{0:d MMM yy} {1} PPT", StartPvt, HE25) : "Interval Null"); default: return(HasValue? string.Format( "{0:d MMM yyyy HH:'00'} Utc", StartUtc): "Interval Null"); } }
public void Print() { System.Console.Out.WriteLine("操舵翼面型: " + type); if (type != 0) { System.Console.Out.WriteLine("作動タイプ: " + actuate_type); baseWingBlock.Print(); System.Console.Out.WriteLine("最大舵角 δmax [deg]: " + MathTool.RadToDeg(delta_max)); System.Console.Out.WriteLine("最小舵角 δmin [deg]: " + MathTool.RadToDeg(delta_min)); System.Console.Out.WriteLine("ヒンジ後退角 λh [rad]: " + MathTool.RadToDeg(lamda_h)); } if (type == 2) { System.Console.Out.WriteLine("ヒンジ上反角 Γh [rad]: " + MathTool.RadToDeg(gamma_h)); System.Console.Out.WriteLine("ヒンジ軸原点 Hc [m]: " + hc.ToStringPos()); } if ((type == 1) || (type == 1)) { Console.Out.WriteLine("フラップ形式: " + Flap.flap_type_name[flap_type]); System.Console.Out.WriteLine("フラップ弦長比: " + cf_c); Console.Out.WriteLine("最大揚力係数の増加分 ΔCLmax: " + dCLmax); Console.Out.WriteLine("前進時フラップの効き: " + DispFormat.DoubleFormat(f_lamda1, 3)); Console.Out.WriteLine("後進時フラップの効き: " + DispFormat.DoubleFormat(b_lamda1, 3)); Console.Out.WriteLine("前進時フラップCmac/δ: " + DispFormat.DoubleFormat(f_cmac, 3)); Console.Out.WriteLine("後進時フラップCmac/δ: " + DispFormat.DoubleFormat(b_cmac, 3)); } if ((type != 0) && (actuate_type == 1)) { Console.Out.WriteLine("展開/格納時間 [s]: " + t_move); } System.Console.Out.WriteLine("---------------------------------------------"); }
public String ToString2() { return("(Vx,Vy,Vz)=(" + DispFormat.DoubleFormat(ov.x, 1) + "," + DispFormat.DoubleFormat(ov.y, 1) + "," + DispFormat.DoubleFormat(ov.z, 1) + ") (q,r,p)=(" + DispFormat.DoubleFormat(ow.x, 1) + "," + DispFormat.DoubleFormat(ow.y, 1) + "," + DispFormat.DoubleFormat(ow.z, 1) + ")"); }
public void Print() { System.Console.Out.WriteLine("OpticalAmbience {"); System.Console.Out.WriteLine("\tIris=" + DispFormat.DoubleFormat(iris, 3)); for (int i = 0; i < NLights(); i++) { GetLight(i).Print(); } }
public String ToString1() { return("(x,y,z)=(" + DispFormat.DoubleFormat(wpos.x, 1) + "," + DispFormat.DoubleFormat(wpos.y, 1) + "," + DispFormat.DoubleFormat(wpos.z, 1) + ") (roll,pitch,yaw)=(" + DispFormat.DoubleFormat(roll.GetValue(), 1) + "," + DispFormat.DoubleFormat(pitch.GetValue(), 1) + "," + DispFormat.DoubleFormat(yaw.GetValue(), 1) + ")"); }
public void Print() { System.Console.Out.Write("Bounding Box :: "); pMin.PrintPos(); System.Console.Out.Write("-"); pMax.PrintPos(); System.Console.Out.Write("diagonal-size:" + DispFormat.DoubleFormat(DiagonalSize(), 3)); System.Console.Out.Write(" x-size:" + DispFormat.DoubleFormat(pMax.x - pMin.x, 3)); System.Console.Out.Write(" y-size:" + DispFormat.DoubleFormat(pMax.y - pMin.y, 3)); System.Console.Out.WriteLine(" z-size:" + DispFormat.DoubleFormat(pMax.z - pMin.z, 3)); }
public void Print() { System.Console.Out.Write("[Diff:"); diffuse.Print(); System.Console.Out.Write("/Spec:"); specular.Print(); System.Console.Out.Write(":" + DispFormat.DoubleFormat(specularSharpness, 1)); System.Console.Out.Write("/Radi:"); radiation.Print(); System.Console.Out.Write("]"); }
public static String TimeStr3(double tIn) { double t = tIn; double hh = Math.Floor(t / 3600.0D); t -= hh * 3600.0D; double mm = Math.Floor(t / 60.0D); double ss = t - mm * 60.0D; return(DispFormat.DoubleFormatZ(hh, 2, 0) + ":" + DispFormat.DoubleFormatZ(mm, 2, 0) + ":" + DispFormat.DoubleFormatZ(ss, 2, 3)); }
public void Print() { System.Console.Out.WriteLine("主翼失速時の垂直尾翼面積係数(αの関数)"); k_SVtail_Wing_stall.Print(); System.Console.Out.WriteLine("水平尾翼失速時の垂直尾翼面積係数(αの関数)"); k_SVtail_Htail_stall.Print(); System.Console.Out.WriteLine("主翼から水平尾翼までの距離 [m]:" + DispFormat.DoubleFormat(lt, 3)); System.Console.Out.WriteLine("主翼から水平尾翼までの角度 [deg]:" + DispFormat.DoubleFormat(angle_t.GetValue() * 180.0D / Math.PI, 1)); System.Console.Out.WriteLine("主翼吹降角の完全影響角(横) [deg]:" + DispFormat.DoubleFormat(wf_beta1 * 180.0D / Math.PI, 1)); System.Console.Out.WriteLine("主翼吹降角の影響がなくなる角度(横) [deg]:" + DispFormat.DoubleFormat(wf_beta2 * 180.0D / Math.PI, 1)); System.Console.Out.WriteLine("主翼吹降角の完全影響角(縦) [deg]:" + DispFormat.DoubleFormat(wf_theta1 * 180.0D / Math.PI, 1)); System.Console.Out.WriteLine("主翼吹降角の影響がなくなる角度(縦) [deg]:" + DispFormat.DoubleFormat(wf_theta2 * 180.0D / Math.PI, 1)); }
public override String ToString() { String ret = "H:" + DispFormat.DoubleFormat(h, 5, 0) + "[m'] " + "t:" + DispFormat.DoubleFormat(tc, 4, 2) + "[��] " + "T:" + DispFormat.DoubleFormat(t, 4, 2) + "[K] " + "p:" + DispFormat.DoubleFormat(p, 6, 0) + "[Pa] " + "��:" + DispFormat.DoubleFormat(rho, 1, 4) + "[kg/m3] " + "a:" + DispFormat.DoubleFormat(a, 1, 4) + "[m/s] " + "��:" + DispFormat.DoubleFormat(mu * 100000.0D, 1, 4) + "E5[Pa�Es] " + "��:" + DispFormat.DoubleFormat(nu * 100000.0D, 1, 4) + "E5[m2/s] "; return(ret); }
public Vector3D ReadVector(String item, bool flagMessage) { double x = 0.0D; double y = 0.0D; double z = 0.0D; String temp = DispFormat.Replace(ReadToKugiri("="), 32, ""); if (!temp.Equals(DispFormat.Replace(item, 32, ""))) { System.Console.Out.WriteLine("*** Error in readVector() item=(" + item + "!=" + temp + ")"); return(null); } if (!Pass("(")) { System.Console.Out.WriteLine("*** Error in readVector() item=(" + item + ") no '('"); return(null); } x = ReadDouble(); if (!Pass(",")) { System.Console.Out.WriteLine("*** Error in readVector() item=(" + item + ") no first','"); return(null); } y = ReadDouble(); if (!Pass(",")) { System.Console.Out.WriteLine("*** Error in readVector() item=(" + item + ") no second','"); return(null); } z = ReadDouble(); if (!Pass(")")) { System.Console.Out.WriteLine("*** Error in readVector() item=(" + item + ") no ')'"); return(null); } Vector3D ret = new Vector3D(x, y, z); if (flagMessage) { System.Console.Out.Write(item + "="); ret.PrintPos(); System.Console.Out.WriteLine(""); } ReadLine(); return(ret); }
public String ReadString(String item, bool flagMessage) { String temp = DispFormat.Replace(ReadToKugiri("/"), 32, ""); if (!temp.Equals(DispFormat.Replace(item, 32, ""))) { System.Console.Out.WriteLine("*** Error in readString() item=(" + item + "!=" + temp + ")"); return(""); } temp = ReadToKugiri("/"); ReadLine(); if (flagMessage) { System.Console.Out.WriteLine(item + "=" + temp); } return(temp); }
public void PrintRow(int row, String pref, String suf) { if ((row < 0) || (row > 3)) { System.Console.Out.WriteLine("dispRow() out of bounds (row=" + row + ")"); } else { System.Console.Out.Write(pref); for (int i = 0; i < 4; i++) { String s = DispFormat.DoubleFormat(element[row, i], 6, 3); System.Console.Out.Write(s + " "); } System.Console.Out.WriteLine(suf); } }
public Color ReadColor(String item, bool flagMessage) { int r = 0; int g = 0; int b = 0; String temp = DispFormat.Replace(ReadToKugiri("="), 32, ""); if (!temp.Equals(DispFormat.Replace(item, 32, ""))) { System.Console.Out.WriteLine("*** Error in readColor() item=(" + item + "!=" + temp + ")"); return(Color.White); } if (!Pass("[")) { System.Console.Out.WriteLine("*** Error in readColor() item=(" + item + ") no '['"); return(Color.White); } r = ReadInteger(); if (!Pass(",")) { System.Console.Out.WriteLine("*** Error in readColor() item=(" + item + ") no first','"); return(Color.White); } g = ReadInteger(); if (!Pass(",")) { System.Console.Out.WriteLine("*** Error in readColor() item=(" + item + ") no second','"); return(Color.White); } b = ReadInteger(); if (!Pass("]")) { System.Console.Out.WriteLine("*** Error in readColor() item=(" + item + ") no ']'"); return(Color.White); } Color ret = Color.FromArgb(r, g, b); if (flagMessage) { System.Console.Out.WriteLine(item + "=" + ret); } ReadLine(); return(ret); }
public double ReadDblValue(String item, bool flagMessage) { String temp = DispFormat.Replace(ReadToKugiri("="), 32, ""); if (!temp.Equals(DispFormat.Replace(item, 32, ""))) { System.Console.Out.WriteLine("*** Error in readDblValue() item=(" + item + "!=" + temp + ")"); return(0.0D); } double ret = ReadDouble(); ReadLine(); if (flagMessage) { System.Console.Out.WriteLine(item + "=" + DispFormat.DoubleFormat(ret, 3)); } return(ret); }
public int ReadIntValue(String item, bool flagMessage) { String temp = DispFormat.Replace(ReadToKugiri("="), 32, ""); if (!temp.Equals(DispFormat.Replace(item, 32, ""))) { System.Console.Out.WriteLine("*** Error in readIntValue() item=(" + item + "!=" + temp + ")"); return(0); } int ret = ReadInteger(); ReadLine(); if (flagMessage) { System.Console.Out.WriteLine(item + "=" + ret); } return(ret); }
public void Print() { if (flag == 1) { System.Console.Out.WriteLine("ブロック名: " + block_name); System.Console.Out.WriteLine("接地基準点位置 [m]: " + p0_base.ToString()); System.Console.Out.WriteLine("静荷重時ストローク [m]: " + stroke0); System.Console.Out.WriteLine("静荷重 [kg]: " + w); tire.Print(); System.Console.Out.WriteLine("抗力係数*代表面積 [m2]: " + cd_s); System.Console.Out.WriteLine("脚格納時の空力着力点 [m]: " + sa.p0.ToString()); System.Console.Out.WriteLine("脚出し時の空力着力点 [m]: " + sa.p1.ToString()); System.Console.Out.WriteLine("脚出し/格納時間 [s]: " + t_move); System.Console.Out.WriteLine("右の作動開始遅れ時間 [s]: " + t_lag_move[0]); System.Console.Out.WriteLine("左の作動開始遅れ時間 [s]: " + t_lag_move[1]); System.Console.Out.WriteLine("緩衝装置のバネ定数 [kg/s2]: " + DispFormat.DoubleFormat(k_sus, 1)); System.Console.Out.WriteLine("緩衝装置のダンパ定数 [kg/s](臨界制振時の50.0%): " + DispFormat.DoubleFormat(c_sus, 1)); } System.Console.Out.WriteLine("---------------------------------------------"); }
public override String ToString() { String ret = ""; ret = DispFormat.DoubleFormat(t, 3); ret = ret + ", " + DispFormat.DoubleFormat(dt * 1000.0D, 1); ret = ret + ", " + DispFormat.DoubleFormat(wpos.x, 3); ret = ret + ", " + DispFormat.DoubleFormat(wpos.y, 3); ret = ret + ", " + DispFormat.DoubleFormat(wpos.z, 3); ret = ret + ", " + DispFormat.DoubleFormat(MathTool.RadToDeg(roll.GetValue()), 3); ret = ret + ", " + DispFormat.DoubleFormat(MathTool.RadToDeg(pitch.GetValue()), 3); ret = ret + ", " + DispFormat.DoubleFormat(MathTool.RadToDeg(yaw.GetValue()), 3); ret = ret + ", " + DispFormat.DoubleFormat(vcDash.x, 3); ret = ret + ", " + DispFormat.DoubleFormat(vcDash.y, 3); ret = ret + ", " + DispFormat.DoubleFormat(vcDash.z, 3); ret = ret + ", " + DispFormat.DoubleFormat(MathTool.RadToDeg(omega.x), 3); ret = ret + ", " + DispFormat.DoubleFormat(MathTool.RadToDeg(omega.y), 3); ret = ret + ", " + DispFormat.DoubleFormat(MathTool.RadToDeg(omega.z), 3); ret = ret + ", " + DispFormat.DoubleFormat(d_vc.x, 3); ret = ret + ", " + DispFormat.DoubleFormat(d_vc.y, 3); ret = ret + ", " + DispFormat.DoubleFormat(d_vc.z, 3); ret = ret + ", " + DispFormat.DoubleFormat(MathTool.RadToDeg(d_omega.x), 3); ret = ret + ", " + DispFormat.DoubleFormat(MathTool.RadToDeg(d_omega.y), 3); ret = ret + ", " + DispFormat.DoubleFormat(MathTool.RadToDeg(d_omega.z), 3); ret = ret + ", " + DispFormat.DoubleFormat(MathTool.RadToDeg(theta), 3); ret = ret + ", " + DispFormat.DoubleFormat(f_m.x, 3); ret = ret + ", " + DispFormat.DoubleFormat(f_m.y, 3); ret = ret + ", " + DispFormat.DoubleFormat(f_m.z, 3); ret = ret + ", " + DispFormat.DoubleFormat(MathTool.RadToDeg(delta_e), 3); ret = ret + ", " + DispFormat.DoubleFormat(MathTool.RadToDeg(delta_a_r), 3); ret = ret + ", " + DispFormat.DoubleFormat(MathTool.RadToDeg(delta_a_l), 3); ret = ret + ", " + DispFormat.DoubleFormat(MathTool.RadToDeg(delta_r), 3); ret = ret + ", " + DispFormat.DoubleFormat(MathTool.RadToDeg(delta_t_flap), 3); ret = ret + ", " + flag_gear; ret = ret + ", " + flag_land; ret = ret + ", " + DispFormat.DoubleFormat(thrust_m, 3); ret = ret + ", " + DispFormat.DoubleFormat(throttle_pos, 3); return(ret); }
private void ReadAirPlaneListFile(AirPlaneList apl, bool flagMessage) { while (true) { int c = ReadSkipSpace(); if (c == -1) { break; } if (c == 35) { ReadLine(); } else { String name = (char)c + DispFormat.Trm(ReadToKugiri("=")); String path = DispFormat.Trm(ReadToKugiri(";")); apl.Add(name, path); ReadLine(); } } }
public bool Pass(String str) { bool ret = true; int i = 0; String str2 = DispFormat.Replace(str, 32, ""); for (i = 0; i < str2.Length;) { char c = (char)Peek(); if (c == -1) { ret = false; break; } if ((char)c == ' ' || (char)c == '\t') { Read(); continue; } if ((char)c != str2[i]) { ret = true; break; } Read(); i++; } return(ret); }
public void DrawInstrument(Graphics g, AirPlane ap, SimulatorInterface simif, double dt) { Matrix44 tmat = new Matrix44(); Matrix44 smat = new Matrix44(); Matrix44 rmat = new Matrix44(); Matrix44 rzmat = new Matrix44(); Matrix44 rxmat = new Matrix44(); Matrix44 mat = new Matrix44(); Scine scine = new Scine(); //g.SetColor(informationColor); //g.SetFont(stdFont); SolidBrush informationBrush = new SolidBrush(informationColor); Pen informationPen = new Pen(informationColor); g.DrawString(ap.plane.name, stdFont, informationBrush, 300 - ap.plane.name.Length * 3, 365); if (simif.dispInformationSw == 1) { double x = ap.pMotion.ov.Length(); //g.DrawString("V: " + Jp.Maker1.Util.DispFormat.DoubleFormat(x, 3, 1) + " m/s", v_true_x, v_true_y); //g.DrawString("V: " + Jp.Maker1.Util.DispFormat.DoubleFormat(Jp.Maker1.Sim.Tools.UnitConvert.Mps2kmph(x), 3, 1) + " km/h", v_true_x, v_true_y + 12); //g.DrawString("V: " + Jp.Maker1.Util.DispFormat.DoubleFormat(Jp.Maker1.Sim.Tools.UnitConvert.Mps2kt(x), 3, 1) + " kt", v_true_x, v_true_y + 24); x = ap.pMotion.wpos.y; //g.DrawString("ALT: " + Jp.Maker1.Util.DispFormat.DoubleFormat(x, 5, 1) + " m", alt_x, alt_y); //g.DrawString("ALT: " + Jp.Maker1.Util.DispFormat.DoubleFormat(Jp.Maker1.Sim.Tools.UnitConvert.M2ft(x), 5, 1) + " ft", alt_x, alt_y + 12); } double pitch = ap.pMotion.pitch.GetValue(); double roll = ap.pMotion.roll.GetValue(); g.DrawString("PIT: " + DispFormat.DoubleFormat(MathTool.RadToDeg(pitch), 5, 1) + " deg", stdFont, informationBrush, 515, 12); g.DrawString("ROL: " + DispFormat.DoubleFormat(MathTool.RadToDeg(roll), 5, 1) + " deg", stdFont, informationBrush, 512, 89); tmat.SetTMat(550.0D, 45.0D, 0.0D); smat.SetSMat(30.0D, -30.0D, 0.0D); if ((roll > 1.570796326794897D) || (roll < -1.570796326794897D)) { rmat.SetRzMat(Math.PI - pitch); } else { rmat.SetRzMat(pitch); } mat = smat.MultMat(rmat).MultMat(tmat); scine.Add(pitch_miniature_aircraft.Transform(mat)); g.DrawEllipse(informationPen, 520, 15, 60, 60); tmat.SetTMat(550.0D, 121.0D, 0.0D); smat.SetSMat(30.0D, -30.0D, 0.0D); rmat.SetRzMat(-roll); mat = smat.MultMat(rmat).MultMat(tmat); scine.Add(roll_miniature_aircraft.Transform(mat)); g.DrawEllipse(informationPen, 520, 91, 60, 60); if (simif.dispInformationSw == 1) { double x_0 = ap.atmos.h; //g.DrawString("H': " + Jp.Maker1.Util.DispFormat.DoubleFormat(x_0, 5, 1) + " m'", atmo_x, atmo_y); x_0 = ap.atmos.tc; //g.DrawString("t: " + Jp.Maker1.Util.DispFormat.DoubleFormat(x_0, 4, 1) + " ��", atmo_x, atmo_y + 12); x_0 = ap.atmos.t; //g.DrawString("T: " + Jp.Maker1.Util.DispFormat.DoubleFormat(x_0, 4, 1) + " K", atmo_x, atmo_y + 24); x_0 = ap.atmos.p; //g.DrawString("p: " + Jp.Maker1.Util.DispFormat.DoubleFormat(x_0 / 100.0D, 4, 1) + " hPa", atmo_x + 90, atmo_y); x_0 = ap.atmos.rho; //g.DrawString("��: " + Jp.Maker1.Util.DispFormat.DoubleFormat(x_0, 1, 3) + " kg/m3", atmo_x + 90, atmo_y + 12); x_0 = ap.atmos.a; // g.DrawString("a: " + Jp.Maker1.Util.DispFormat.DoubleFormat(x_0, 3, 1) + " m/sec", atmo_x + 90, atmo_y + 24); } double alpha = ap.pMotion.alpha; double beta = ap.pMotion.beta; if (simif.dispInformationSw == 1) { //g.DrawString("��: " + Jp.Maker1.Util.DispFormat.DoubleFormat(Jp.Maker1.Util.MathTool.RadToDeg(alpha), 3, 1) + " deg", 2, 60); // g.DrawString("��: " + Jp.Maker1.Util.DispFormat.DoubleFormat(Jp.Maker1.Util.MathTool.RadToDeg(beta), 3, 1) + " deg", 2, 72); } Vector3D vec = ap.pMotion.ov.SclProd(60000000.0D).MultMat(ap.pilot.ViewMatrix()); if ((vec != null) && (vec.z > 0.0D)) { vec = proj.Project(vec); tmat.SetTMat(vec.x, vec.y, vec.z); scine.Add(velocity_vector.Transform(tmat)); } vec.SetVec(0.0D, 0.0D, 60000000.0D); vec = vec.MultMat(ap.pilot.ViewMatrix()); if ((vec != null) && (vec.z > 0.0D)) { vec = proj.Project(vec); tmat.SetTMat(vec.x, vec.y, vec.z); scine.Add(front_point.Transform(tmat)); } vec = ap.pMotion.force.R2l().SclProd(-1.0D / ap.inp.m); vec.z = 0.0D; double x_1 = vec.Length(); Vector3D vec2 = vec.NmlVec().SclProd(50.0D); vec = vec.NmlVec().SclProd(100.0D); Vector3D vec3 = vec.NmlVec().SclProd(113.0D); Jp.Maker1.Util.Symbol.DrawArrow(g, 300 + (int)vec2.x, 200 - (int)vec2.y, 300 + (int)vec.x, 200 - (int)vec.y, 50.0D, x_1 * 4.0D); //g.DrawString(Jp.Maker1.Util.DispFormat.DoubleFormat(x_1 / 9.80655D, 2) + "G", 286 + (int)vec3.x, 200 - (int)vec3.y); vec = ap.pMotion.force.R2l().SclProd(-1.0D / ap.inp.m); x_1 = vec.z; // g.DrawString(Jp.Maker1.Util.DispFormat.DoubleFormat(x_1 / 9.80655D, 2) + "G", 120, 192); if (Math.Abs((int)(x_1 * 10.0D)) >= 1) { Jp.Maker1.Util.Symbol.DrawArrow(g, 150, 200, 150 + (int)(x_1 * 10.0D), 200, (int)(Math.Abs(x_1) * 10.0D), 10.0D); Jp.Maker1.Util.Symbol.DrawArrow(g, 450, 200, 450 - (int)(x_1 * 10.0D), 200, (int)(Math.Abs(x_1) * 10.0D), 10.0D); } int xx = 2; int yy = 100; vec = ap.pMotion.force.SclProd(-1.0D / ap.inp.m / 9.80655D); if (simif.dispInformationSw == 1) { //g.DrawString("Gx: " + Jp.Maker1.Util.DispFormat.DoubleFormat(vec.x, 2, 4) + " [G]", xx, yy); yy += 11; // g.DrawString("Gy: " + Jp.Maker1.Util.DispFormat.DoubleFormat(vec.y, 2, 4) + " [G]", xx, yy); yy += 11; //g.DrawString("Gz: " + Jp.Maker1.Util.DispFormat.DoubleFormat(vec.z, 2, 4) + " [G]", xx, yy); yy += 11; } if (ap.max_k_stall_wing > 1.0D) { //g.DrawString("STALL", stallAlert_x + 25, stallAlert_y); } else if (ap.max_k_stall_wing > 0.95D) { //g.DrawString("STALL WARNING", stallAlert_x, stallAlert_y); } //g.SetColor(instrumentColor); double yaw = ap.pMotion.yaw.GetValue(); //g.DrawString("HDG: " + Jp.Maker1.Util.DispFormat.DoubleFormat(Jp.Maker1.Util.MathTool.RadToDeg(yaw), 5, 1) + " deg", 512, 165); tmat.SetTMat(550.0D, 197.0D, 0.0D); smat.SetSMat(30.0D, 30.0D, 0.0D); rmat.SetRzMat(yaw); mat = smat.MultMat(rmat).MultMat(tmat); scine.Add(heading_miniature_aircraft.Transform(mat)); // g.DrawOval(520, 167, 60, 60); rzmat.SetRzMat(-ap.pMotion.roll.GetValue()); rxmat.SetRxMat(-ap.pMotion.pitch.GetValue()); mat = rxmat.MultMat(rzmat); Scine scine2 = new Scine(); scine2.Add(artificial_horizon.Transform(mat.MultMat(ap.pilot.ViewMatrix()))); Scine view = new Scine(); view = scine2.MakeView(clip, proj, false); view.Draw(g); // g.SetFont(bigFont); x_1 = ap.pMotion.vc.Length() * Math.Sqrt(ap.atmos.rho / 1.225D); // g.DrawString("ASI: " + Jp.Maker1.Util.DispFormat.DoubleFormat(Jp.Maker1.Sim.Tools.UnitConvert.Mps2kt(x_1), 3, 0) + " kt", 190, 380); x_1 = ap.pMotion.wpos.y; //g.DrawString("ALT: " + Jp.Maker1.Util.DispFormat.DoubleFormat(Jp.Maker1.Sim.Tools.UnitConvert.M2ft(x_1), 5, 0) + " ft", 190, 396); x_1 = ap.pMotion.wv.y; //g.DrawString("VSI: " + Jp.Maker1.Util.DispFormat.DoubleFormat(Jp.Maker1.Sim.Tools.UnitConvert.M2ft(x_1) * 60.0D, 5, 0) + " fpm", 305, 380); x_1 = ap.pMotion.omega.z; // g.DrawString("YRT: " + Jp.Maker1.Util.DispFormat.DoubleFormat(Jp.Maker1.Util.MathTool.RadToDeg(x_1) * 60.0D, 3, 0) + " deg/m", 305, 396); for (int i = 0; i < ap.n_LandingGear; i++) { if (ap.landing_gear[i, 1].flag == 1) { xx = gear_x; } else { xx = gear_x - gear_box_maegine / 2; } yy = gear_y + i * gear_box_maegine * 3; for (int lr = 0; lr <= 1; lr++) { if (ap.landing_gear[i, lr].flag == 1) { int xx1; if (lr == 0) { xx1 = xx + gear_box_maegine; } else { xx1 = xx; } x_1 = ap.landing_gear[i, lr].delta; if (x_1 == 0.0D) { //g.SetColor(instrumentRed); //g.FillRect(xx1 + 2, yy + 2, gear_box_size - 3, gear_box_size - 3); } else if (x_1 == 1.0D) { //g.SetColor(instrumentGreen); //g.FillRect(xx1 + 2, yy + 2 + gear_box_maegine * 2, gear_box_size - 3, gear_box_size - 3); } else { // g.SetColor(instrumentYellow); // g.FillRect(xx1 + 2, yy + 2 + gear_box_maegine, gear_box_size - 3, gear_box_size - 3); } //g.SetColor(instrumentColor); //g.DrawRect(xx1, yy, gear_box_size, gear_box_size); //g.DrawRect(xx1, yy + gear_box_maegine, gear_box_size, gear_box_size); //g.DrawRect(xx1, yy + gear_box_maegine * 2, gear_box_size, gear_box_size); } } } //g.SetFont(smallFont); ControlPlane flap = ap.t_flap[0, 0]; if (ap.t_flap[0, 0].type != 0) { xx = flap_x; yy = flap_y; // g.DrawRect(xx, yy - flap_width, 10, flap_width); for (double ang = 0.0D; ang < MathTool.RadToDeg(flap.delta_max) + 0.1D; ang += 10.0D) { x_1 = (MathTool.DegToRad(ang) - flap.delta_min) / (flap.delta_max - flap.delta_min); int yy1 = yy - flap_width + (int)(flap_width * x_1 + 0.5D); // g.DrawLine(xx + 10, yy1, xx + 13, yy1); // g.DrawString("" + (int)ang, xx + 14, yy1); } x_1 = (flap.delta - flap.delta_min) / (flap.delta_max - flap.delta_min); int yy1_2 = (int)(flap_width * x_1 + 0.5D); // g.FillRect(xx + 2, yy - flap_width, 7, yy1_2); } //g.SetFont(stdFont); scine.Draw(g); //g.SetFont(stdFont); }
public override void Print() { System.Console.Out.WriteLine("Scine {"); System.Console.Out.WriteLine("DrawOrder {"); for (int i = 0; i < drawOrder.Count; i++) { System.Console.Out.WriteLine("\torder:" + (i + 1) + " element[" + drawOrder[i] + "]" + "depth = " + DispFormat.DoubleFormat(Depth(((Int32)drawOrder[i])), 3)); } System.Console.Out.WriteLine(""); System.Console.Out.WriteLine("}"); base.Print(); System.Console.Out.WriteLine("}"); }
public void DrawData(Graphics g, SimulatorInterface simif) { if (recorder.N_record() == 0) { //g.SetColor(Java.Awt.Color.black); // g.SetFont(stdFont); // g.DrawString("No Data", 290, 180); return; } if (simif.record_output_sw == 1) { // g.SetColor(Java.Awt.Color.red); // g.SetFont(stdFont); // g.DrawString("Writing Data", 270, 100); return; } RecordData data = recorder.GetData(currentDataIndex); VsPoint pos = new VsPoint(new Vector3D(data.wpos), Color.White); pos = (VsPoint)pos.Transform(mat); pos = (VsPoint)pos.Clip3DF(clip); pos = (VsPoint)pos.Project(proj); VsSegment seg = new VsSegment(new Vector3D(data.wpos), new Vector3D( data.wpos), suisenCol); seg.seg.p1.y = grid.ys; seg = (VsSegment)seg.Transform(mat); seg = (VsSegment)seg.Clip3DF(clip); seg = (VsSegment)seg.Project(proj); seg.Draw(g); pos.Draw(g); if (pos.pos != null) { int px = (int)(pos.pos.x + 0.5D); int py = (int)(pos.pos.y + 0.5D); //g.SetColor(cursolCol); //g.DrawRect(px - 10, py - 10, 21, 21); } //g.SetColor(infoCol); //g.SetFont(stdFont); String str = "GRID SCALE:" + DispFormat.DoubleFormat(grid.grid_scale, 0) + "m"; str = str + " BASE ALT:" + DispFormat.DoubleFormat(LocusGrid.Y_base(locus.locusBBox), 0) + "m"; // g.DrawString(str, 3, (int)(proj.screenYOffset + proj.screenYSize) - 4); str = "DATA No." + (currentDataIndex + 1) + " TIME:" + Jp.Maker1.Sim.Tools.Tool.TimeStr1(data.t); // g.DrawString(str, 300, 13); // g.SetFont(smallFont); int datax = 3; int datay = 30; int dy = 10; if (simif.dispDataSw == 1) { double h = data.wpos.y; datay += 2; //g.DrawString("XE [m] : " + Jp.Maker1.Util.DispFormat.DoubleFormat(data.wpos.x, 4, 1), datax, datay); datay += dy; //g.DrawString("YE [m] : " + Jp.Maker1.Util.DispFormat.DoubleFormat(h, 4, 1), datax, datay); datay += dy; //g.DrawString("ZE [m] : " + Jp.Maker1.Util.DispFormat.DoubleFormat(data.wpos.z, 4, 1), datax, datay); datay += dy; //g.DrawString("YE [ft]: " + Jp.Maker1.Util.DispFormat.DoubleFormat(Jp.Maker1.Sim.Tools.UnitConvert.M2ft(h), 4, 1), datax, datay); datay += dy; datay += 2; double v = data.vcDash.Length(); //g.DrawString("VC [m/s]: " + Jp.Maker1.Util.DispFormat.DoubleFormat(v, 3, 1), datax, datay); datay += dy; double ias = Jp.Maker1.Sim.Tools.UnitConvert.Mps2kt(v) * Math.Sqrt(Isa.Density(h) / Isa.Density(0.0D)); //g.DrawString("IAS [kt]: " + Jp.Maker1.Util.DispFormat.DoubleFormat(ias, 3, 1), datax, datay); datay += dy; double alpha = MathTool.RadToDeg(Jp.Maker1.Sim.Tools.Tool.CalcAlpha(data.vcDash)); datay += 2; //g.DrawString("ƒ¿ [deg]: " + Jp.Maker1.Util.DispFormat.DoubleFormat(alpha, 3, 1), datax, datay); datay += dy; double beta = MathTool.RadToDeg(Jp.Maker1.Sim.Tools.Tool.CalcBeta(data.vcDash)); //g.DrawString("ƒÀ [deg]: " + Jp.Maker1.Util.DispFormat.DoubleFormat(beta, 3, 1), datax, datay); datay += dy; datay += 2; // g.DrawString("ƒ³ [deg]: " + Jp.Maker1.Util.DispFormat.DoubleFormat(Jp.Maker1.Util.MathTool.RadToDeg(data.roll.GetValue()), 3, 1), datax, datay); datay += dy; // g.DrawString("ƒ¦ [deg]: " + Jp.Maker1.Util.DispFormat.DoubleFormat(Jp.Maker1.Util.MathTool.RadToDeg(data.pitch.GetValue()), 3, 1), datax, datay); datay += dy; // g.DrawString("ƒµ [deg]: " + Jp.Maker1.Util.DispFormat.DoubleFormat(Jp.Maker1.Util.MathTool.RadToDeg(data.yaw.GetValue()), 3, 1), datax, datay); datay += dy; datay += 2; // g.DrawString("P [deg/s]: " + Jp.Maker1.Util.DispFormat.DoubleFormat(Jp.Maker1.Util.MathTool.RadToDeg(data.omega.x), 3, 1), datax, datay); datay += dy; // g.DrawString("Q [deg/s]: " + Jp.Maker1.Util.DispFormat.DoubleFormat(Jp.Maker1.Util.MathTool.RadToDeg(data.omega.y), 3, 1), datax, datay); datay += dy; // g.DrawString("R [deg/s]: " + Jp.Maker1.Util.DispFormat.DoubleFormat(Jp.Maker1.Util.MathTool.RadToDeg(data.omega.z), 3, 1), datax, datay); datay += dy; datay += 2; // g.DrawString("dU/dt [m/s2]: " + Jp.Maker1.Util.DispFormat.DoubleFormat(data.d_vc.x, 2, 1), datax, datay); datay += dy; // g.DrawString("dV/dt [m/s2]: " + Jp.Maker1.Util.DispFormat.DoubleFormat(data.d_vc.y, 2, 1), datax, datay); datay += dy; // g.DrawString("dW/dt [m/s2]: " + Jp.Maker1.Util.DispFormat.DoubleFormat(data.d_vc.z, 2, 1), datax, datay); datay += dy; datay += 2; // g.DrawString("dP/dt [deg/s2]: " + Jp.Maker1.Util.DispFormat.DoubleFormat(Jp.Maker1.Util.MathTool.RadToDeg(data.d_omega.x), 3, 1), datax, datay); datay += dy; //g.DrawString("dQ/dt [deg/s2]: " + Jp.Maker1.Util.DispFormat.DoubleFormat(Jp.Maker1.Util.MathTool.RadToDeg(data.d_omega.y), 3, 1), datax, datay); datay += dy; // g.DrawString("dR/dt [deg/s2]: " + Jp.Maker1.Util.DispFormat.DoubleFormat(Jp.Maker1.Util.MathTool.RadToDeg(data.d_omega.z), 3, 1), datax, datay); datay += dy; datay += 2; //g.DrawString("ƒÆ [deg]: " + Jp.Maker1.Util.DispFormat.DoubleFormat(Jp.Maker1.Util.MathTool.RadToDeg(data.theta), 3, 1), datax, datay); datay += dy; datay += 2; //g.DrawString("Fx/m [m/s2]: " + Jp.Maker1.Util.DispFormat.DoubleFormat(data.f_m.x, 3, 1), datax, datay); datay += dy; //g.DrawString("Fy/m [m/s2]: " + Jp.Maker1.Util.DispFormat.DoubleFormat(data.f_m.y, 3, 1), datax, datay); datay += dy; // g.DrawString("Fz/m [m/s2]: " + Jp.Maker1.Util.DispFormat.DoubleFormat(data.f_m.z, 3, 1), datax, datay); datay += dy; datay += 2; // g.DrawString("ƒÂe [deg] : " + Jp.Maker1.Util.DispFormat.DoubleFormat(Jp.Maker1.Util.MathTool.RadToDeg(data.delta_e), 3, 1), datax, datay); datay += dy; // g.DrawString("ƒÂaR [deg]: " + Jp.Maker1.Util.DispFormat.DoubleFormat(Jp.Maker1.Util.MathTool.RadToDeg(data.delta_a_r), 3, 1), datax, datay); datay += dy; // g.DrawString("ƒÂaL [deg]: " + Jp.Maker1.Util.DispFormat.DoubleFormat(Jp.Maker1.Util.MathTool.RadToDeg(data.delta_a_l), 3, 1), datax, datay); datay += dy; // g.DrawString("ƒÂr [deg]: " + Jp.Maker1.Util.DispFormat.DoubleFormat(Jp.Maker1.Util.MathTool.RadToDeg(data.delta_r), 3, 1), datax, datay); datay += dy; // g.DrawString("ƒÂf [deg]: " + Jp.Maker1.Util.DispFormat.DoubleFormat(Jp.Maker1.Util.MathTool.RadToDeg(data.delta_t_flap), 3, 1), datax, datay); datay += dy; // g.DrawString("L.GEAR: " + data.flag_gear, datax, datay); datay += dy; // g.DrawString("LAND: " + data.flag_land, datax, datay); datay += dy; datay += 2; // g.DrawString("Thrust/m [m/s2]: " + Jp.Maker1.Util.DispFormat.DoubleFormat(data.thrust_m, 3, 1), datax, datay); datay += dy; // g.DrawString("THR-POS [m/s2]: " + Jp.Maker1.Util.DispFormat.DoubleFormat(data.throttle_pos, 3, 2), datax, datay); datay += dy; } }
private String PrintVal(double x) { return(DispFormat.DoubleFormat(x, 5, 3)); }
private String PrintDeg(double x) { return(DispFormat.DoubleFormat(MathTool.RadToDeg(x), 3)); }
//public virtual void Run() //{ // //while (thread == ILOG.J2CsMapping.Threading.ThreadWrapper.CurrentThread) // { // //Repaint(); // try // { // //Sleep(tp.ThreadPeriodMsec()); // } // catch (ThreadInterruptedException localInterruptedException) // { // } // } //} //public override void Start() //{ // if (thread == null) // { // thread = new ThreadWrapper(this); // thread.Start(); // } //} //public override void Stop() //{ // thread = null; //} public void Update(Graphics g) { if (simIF.changePlane == 1) { //g.DrawString("Now Loading...", 200, 250); System.Console.Out.WriteLine("################# 飛行機変更 ############################################"); System.Console.Out.WriteLine("飛行機番号=" + configMenu.selectedAirPlane); System.Console.Out.WriteLine("CODEBASE=" + codeBase); System.Console.Out.WriteLine("PATH=" + configMenu.apl.GetPath(configMenu.selectedAirPlane)); simIF.changePlane = 0; ap = new AirPlane(codeBase, configMenu.apl.GetPath(configMenu.selectedAirPlane)); ap.Set_pMotionLand(); InitPadlockList(); } if (simIF.changePSetting == 1) { configMenu.SetPSetting(tp); simIF.changePSetting = 0; } if (simIF.pause_sw == 0) { simIF.counter -= 1; if (simIF.counter <= 0) { for (int i = 0; i < tp.t_disp; i++) { ap.Update(tp.dt); if (ap.crash_point != -1) { Jp.Maker1.Util.Gui.Caption.SetCaption("POINT " + ap.crash_point + " TOUCH THE GROUND.", 4.0D); } tp.simT += tp.dt; tp.rec_counter += 1; if (tp.rec_counter >= tp.t_record) { recorder.Record(tp.simT, tp.dt, ap); tp.rec_counter = 0; } } if (simIF.slow_mode == 1) { simIF.counter = simIF.slow_count; } else { simIF.counter = 0; } } } if (simIF.mode == 0) { gd.CreateImage(myGC, ap, simIF, tp.dt); //myGC.SetColor(Java.Awt.Color.black); myGC.DrawRectangle(Pens.Black, (int)sX0, (int)sY0, (int)(sX1 - sX0 - 1.0D), (int)(sY1 - sY0 - 1.0D)); } else if (simIF.mode == 1) { if (simIF.locusMake == 1) { //g.SetColor(Java.Awt.Color.white); //g.FillRect((int)sX0, (int)sY0, (int)(sX1 - sX0 + 1.0D), (int)(sY1 - sY0 + 1.0D)); //g.SetColor(Java.Awt.Color.black); //g.DrawString("Now Drawing...", 280, 150); locusVierer = new LocusViewer(sX0, sY0, sX1, sY1, ap, recorder); simIF.locusMake = 0; } locusVierer.UpdateDispParam(simIF, tp.ThreadPeriod()); if (simIF.locusImageMake == 1) { //g.SetColor(Java.Awt.Color.white); //g.FillRect((int)sX0, (int)sY0, (int)(sX1 - sX0 + 1.0D), (int)(sY1 - sY0 + 1.0D)); //g.SetColor(Java.Awt.Color.black); //g.DrawString("Now Drawing...", 280, 150); locusVierer.DrawLocus(locusGC, 1); // myGC.DrawImage(LocusImage, 0, 0, this); simIF.locusImageMake = 0; } //myGC.DrawImage(LocusImage, 0, 0, this); if (simIF.Check_locus_action_sw() > 0) { // myGC.DrawImage(LocusImage, 0, 0, this); locusVierer.DrawLocus(myGC, 0); } locusVierer.DrawData(myGC, simIF); // myGC.SetColor(Java.Awt.Color.black); //myGC.DrawRect((int)sX0, (int)sY0, (int)(sX1 - sX0 - 1.0D), (int)(sY1 - sY0 - 1.0D)); } else if (simIF.mode == 2) { configMenu.Draw(myGC, "Ver.1.1 2003.11.04"); } tp.tsim_dt += tp.ThreadPeriod(); long t_end = (DateTime.Now.Ticks / 10000); if (simIF.pause_sw == 0) { //myGC.SetColor(gd.informationColor); myGC.DrawString("ΔT:" + DispFormat.DoubleFormat(tp.dt * 1000.0D, 3, 0), gd.stdFont, gd.interfaceColorBrush, 2, 11); //myGC.DrawString("T:" + Jp.Maker1.Sim.Tools.Tool.TimeStr3(tp.simT), 2, 22); //myGC.DrawString("T-ΣΔT:" + Jp.Maker1.Util.DispFormat.DoubleFormat((t_end - tp.tStart) / 1000.0D - tp.tsim_dt, 3, 3), 2, 33); //myGC.DrawString("TGT.FR:" + Jp.Maker1.Util.DispFormat.DoubleFormat(1.0D / tp.ThreadPeriod(), 3, 1), 2, 44); } Jp.Maker1.Util.Gui.Caption.Draw(myGC); Jp.Maker1.Util.Gui.Caption.Update(tp.ThreadPeriod()); //g.DrawImage(doubleBuffer, 0, 0, this); if (simIF.record_output_sw == 1) { simIF.record_output_sw = 0; recorder.Print("Ver.1.1 2003.11.04"); } }
private bool Vs_read_form_unit(bool message_mode) { int head_read_order = 0; name = null; vertex = new ArrayList(); fvno = new ArrayList(); obj0 = new VsObject(); depth_sort_sw = 1; scale = 1.0D; while (true) { int c = ReadSkipSpace(); if (c == -1) { if (head_read_order != 0) { System.Console.Out.WriteLine("エラー: 形状フォーム読み込み中に EOF が表れました.vs_read_form_unit()\n"); } return(false); } if ((char)c == '#') { ReadLine(); } else { String command = ((char)c + ReadAWord()).ToUpper(); if (head_read_order == 0) { if (!command.Equals("FORM_UNIT")) { System.Console.Out.WriteLine("エラー: [FORM_UNIT]コマンド以外のコマンド[" + command + "]が最初に表れました.vs_read_form_unit()"); return(false); } name = ReadAWord(); if (message_mode) { System.Console.Out.WriteLine("----------------------------------------"); System.Console.Out.WriteLine("FORM UNIT '" + name + "' READING..."); } head_read_order++; } else if (head_read_order == 1) { if (!command.Equals("DEPTH_SORT")) { System.Console.Out.WriteLine("エラー: [DEPTH_SORT]コマンド以外のコマンド[" + command + "]が2番目に表れました.vs_read_form_unit()"); return(false); } String buf = ReadAWord().ToUpper(); if (buf.Equals("ON")) { depth_sort_sw = 1; head_read_order++; } else if (buf.Equals("OFF")) { depth_sort_sw = 0; head_read_order++; } else { System.Console.Out.WriteLine("エラー: [DEPTH_SORT]コマンドに不当なパラメータ[" + buf + "]が指定されました.vs_read_form_unit()"); return(false); } } else if (head_read_order == 2) { if (!command.Equals("SCALE")) { System.Console.Out.WriteLine("エラー: [SCALE]コマンド以外のコマンド[" + command + "]が3番目に表れました.vs_read_form_unit()"); return(false); } scale = ReadDouble(); if (scale == 0.0D) { System.Console.Out.WriteLine("エラー: [SCALE]コマンド: ゼロが設定されました.vs_read_form_unit()"); return(false); } head_read_order++; } else { if (command.Equals("FORM_END")) { break; } if (command.Equals("VERTEX")) { c = ReadSkipSpace(); if ((char)c != '{') { System.Console.Out.WriteLine("エラー: [VERTEX]コマンド:{ が無いか,または { の前に空白が有りません.vs_read_form_unit()"); return(false); } int check = Vs_read_vertexs(); if (check == -1) { System.Console.Out.WriteLine("エラー: [VERTEX]コマンド: ブロック内文法エラー.vs_read_form_unit()"); return(false); } } else if (command.Equals("POINT")) { String id = ReadAWord(); Color col = mdf.GetColor(id); if (col == null) { System.Console.Out.WriteLine("エラー: [POINT]コマンド: 存在しないマテリアルIDが指定されています.vs_read_form_unit()"); return(false); } ArrayList p = Vs_read_points(); if (p.Count != 1) { System.Console.Out .WriteLine("エラー: [POINT]コマンド: 頂点数が1になっていません.vs_read_form_unit()"); return(false); } obj0.Add(new VsPoint((Vector3D)vertex[((Int32)p[0])], col)); } else if (command.Equals("LINE")) { String id_0 = ReadAWord(); Color col_1 = mdf.GetColor(id_0); if (col_1 == null) { System.Console.Out.WriteLine("エラー: [LINE]コマンド: 存在しないマテリアルIDが指定されています.vs_read_form_unit()"); return(false); } ArrayList p_2 = Vs_read_points(); if (p_2.Count != 2) { System.Console.Out.WriteLine("エラー: [LINE]コマンド: 頂点数が2になっていません.vs_read_form_unit()"); return(false); } Vector3D p0 = new Vector3D((Vector3D)vertex[((Int32)p_2[0])]); Vector3D p1 = new Vector3D((Vector3D)vertex[((Int32)p_2[1])]); obj0.Add(new VsSegment(p0.x, p0.y, p0.z, p1.x, p1.y, p1.z, col_1)); } else if (command.Equals("POLYGON_2")) { String id1 = ReadAWord(); String id2 = ReadAWord(); String type1 = mdf.GetType(id1); String type2 = mdf.GetType(id2); if (!type1.Equals(type2)) { System.Console.Out.WriteLine("エラー: [POLYGON_2]コマンド: 表裏のマテリアルIDが異なっています.vs_read_form_unit()"); return(false); } Color col_3; Color colB; Material mate = null; Material mateB = null; if (type1.Equals("Color")) { col_3 = mdf.GetColor(id1); } else if (type1.Equals("Material")) { mate = mdf.GetMaterial(id1); } if (type2.Equals("Color")) { colB = mdf.GetColor(id2); } else if (type2.Equals("Material")) { mateB = mdf.GetMaterial(id2); } //if (((col_3 == null) && (mate == null)) || ((colB == null) && (mateB == null))) { System.Console.Out.WriteLine("エラー: [POLYGON_2]コマンド: 存在しないマテリアルIDが指定されています.vs_read_form_unit()"); return(false); } ArrayList p_4 = Vs_read_points(); if (p_4.Count < 3) { System.Console.Out .WriteLine("エラー: [POLYGON_2]コマンド: 頂点数が3以下です.vs_read_form_unit()"); return(false); } if (type1.Equals("Color")) { VsPolygon2 pp = new VsPolygon2(); pp.col = col_3; pp.colB = colB; for (int i = 0; i < p_4.Count; i++) { Vector3D ppp = new Vector3D((Vector3D)vertex[((Int32)p_4[i])]); pp.pol.AddVertex(ppp); } obj0.Add(pp); } else { VsPolygon4 pp_5 = new VsPolygon4(); pp_5.mate = mate; pp_5.mateB = mateB; for (int i_6 = 0; i_6 < p_4.Count; i_6++) { Vector3D ppp_7 = new Vector3D((Vector3D)vertex[((Int32)p_4[i_6])]); pp_5.pol.AddVertex(ppp_7); } obj0.Add(pp_5); } } else if (command.Equals("POLYGON_1")) { String id_8 = ReadAWord(); String type = mdf.GetType(id_8); Color col_9; Material mate_10 = null; if (type.Equals("Color")) { col_9 = mdf.GetColor(id_8); } else if (type.Equals("Material")) { mate_10 = mdf.GetMaterial(id_8); } //if ((col_9 == null) && (mate_10 == null)) { System.Console.Out.WriteLine("エラー: [POLYGON_1]コマンド: 存在しないマテリアルIDが指定されています.vs_read_form_unit()"); return(false); } ArrayList p_11 = Vs_read_points(); if (p_11.Count < 3) { System.Console.Out.WriteLine("エラー: [POLYGON_1]コマンド: 頂点数が3以下です.vs_read_form_unit()"); return(false); } if (type.Equals("Color")) { VsPolygon pp_12 = new VsPolygon(); pp_12.col = col_9; for (int i_13 = 0; i_13 < p_11.Count; i_13++) { Vector3D ppp_14 = new Vector3D((Vector3D)vertex[((Int32)p_11[i_13])]); pp_12.pol.AddVertex(ppp_14); } obj0.Add(pp_12); } else { VsPolygon3 pp_15 = new VsPolygon3(); pp_15.mate = mate_10; for (int i_16 = 0; i_16 < p_11.Count; i_16++) { Vector3D ppp_17 = new Vector3D((Vector3D)vertex[((Int32)p_11[i_16])]); pp_15.pol.AddVertex(ppp_17); } obj0.Add(pp_15); } } else if (command.Equals("POLYLINE")) { String id_18 = ReadAWord(); Color col_19 = mdf.GetColor(id_18); if (col_19 == null) { System.Console.Out.WriteLine("エラー: [POLYLINE]コマンド: 存在しないマテリアルIDが指定されています.vs_read_form_unit()"); return(false); } ArrayList p_20 = Vs_read_points(); if (p_20.Count < 2) { System.Console.Out.WriteLine("エラー: [POLYLINE]コマンド: 頂点数が2以下です.vs_read_form_unit()"); return(false); } for (int i_21 = 0; i_21 < p_20.Count - 1; i_21++) { Vector3D p0_22 = new Vector3D((Vector3D)vertex[((Int32)p_20[i_21])]); Vector3D p1_23 = new Vector3D((Vector3D)vertex[((Int32)p_20[i_21 + 1])]); obj0.Add(new VsSegment(p0_22.x, p0_22.y, p0_22.z, p1_23.x, p1_23.y, p1_23.z, col_19)); } } else { System.Console.Out.WriteLine("エラー: 不当なコマンド[" + command + "]が現れました.vs_read_form_unit()"); return(false); } } } } if (message_mode) { String command_24; int c_25; System.Console.Out.WriteLine("<FORM UNIT> NAME:[" + name + "]"); System.Console.Out.WriteLine(" DEPTH SORT SW:[" + depth_sort_sw + "] SCALE FACTOR:[" + scale + "]"); System.Console.Out.WriteLine("NUMBER of VERTEX:[" + vertex.Count + "]"); System.Console.Out.WriteLine("VERTEX:"); for (int i_26 = 0; i_26 < vertex.Count; i_26++) { String vtxId = DispFormat.Lpad(((Int32)fvno[i_26]).ToString(), 3); if (vtxId.Equals("-99")) { vtxId = " "; } System.Console.Out.Write(" " + vtxId + " : "); ((Vector3D)vertex[i_26]).PrintPos(); System.Console.Out.WriteLine(""); } obj0.Print(); System.Console.Out.WriteLine("NUMBER of ELEMENT:" + obj0.element.Count); System.Console.Out.WriteLine("-----------------------------------------------\n"); } return(true); }
public void DrawDynamics(Graphics g, AirPlane ap, double dt) { DrawArrangement dr = new DrawArrangement(); Vector3D vec = new Vector3D(); //g.SetFont(new Font("Sansserif", 11)); //g.DrawString("��base[deg]:" + Jp.Maker1.Util.DispFormat.DoubleFormat(ap.interference.wf_epsilon / Math.PI * 180.0D, 2), 200, 88); //g.DrawString("��[deg]:" + Jp.Maker1.Util.DispFormat.DoubleFormat(ap.interference.wf_epsilon_htail / Math.PI * 180.0D, 2), 200, 100); //g.DrawString("CL:" + DispFormat.DoubleFormat(ap.interference.wing_cl, 2), 200, 76); //g.DrawString("AR:" + DispFormat.DoubleFormat(ap.interference.wing_ar, 2), 200, 64); //g.DrawString("WG K_STALL:" + Jp.Maker1.Util.DispFormat.DoubleFormat(ap.max_k_stall_wing, 2), 400, 64); //g.DrawString("HT K_STALL:" + Jp.Maker1.Util.DispFormat.DoubleFormat(ap.max_k_stall_htail, 2), 400, 76); int xx = 220; int y = 240; //g.SetFont(new Font("Sansserif", 0, 11)); int lr; for (lr = 0; lr < 2; lr++) { if (ap.elevator[0, lr].type != 0) { // g.DrawString("��e" + Jp.Maker1.Fsim.AirPlane.lrName[lr] + ":" + Jp.Maker1.Util.DispFormat.DoubleFormat(Jp.Maker1.Util.MathTool.RadToDeg(ap.elevator[0, lr].delta), 1), xx, y); y += 12; } } //g.SetFont(new Font("Sansserif", 11)); y = 150; int dy = 9; xx = 2; int i; for (i = 0; i < ap.n_wing; i++) { for (lr = 0; lr < ap.wing[i].n_lr; lr++) { for (int j = 0; j < ap.wing[i].n_wing_block; j++) { String str = "W" + j + AirPlane.lrName[lr] + ": " + DispFormat.DoubleFormat(ap.wing[i].wp[j, lr].k_stall, 4); // g.DrawString(str, xx, y); y += dy; } } } y += 3; for (i = 0; i < ap.n_htail; i++) { for (lr = 0; lr < ap.htail[i].n_lr; lr++) { for (int j_0 = 0; j_0 < ap.htail[i].n_wing_block; j_0++) { String str_1 = "H" + j_0 + AirPlane.lrName[lr] + ": " + DispFormat.DoubleFormat(ap.htail[i].wp[j_0, lr].k_stall, 4); // g.DrawString(str_1, xx, y); y += dy; } } } y += 3; for (i = 0; i < ap.n_vtail; i++) { for (lr = 0; lr < ap.vtail[i].n_lr; lr++) { for (int j_2 = 0; j_2 < ap.vtail[i].n_wing_block; j_2++) { String str_3 = "V" + j_2 + AirPlane.lrName[lr] + ": " + DispFormat.DoubleFormat(ap.vtail[i].wp[j_2, lr].k_stall, 4); // g.DrawString(str_3, xx, y); y += dy; } } } y += 3; for (i = 0; i < ap.n_elevator; i++) { for (lr = 0; lr <= 1; lr++) { if (ap.elevator[i, lr].type != 0) { String str_4 = "E" + i + AirPlane.lrName[lr] + ": " + DispFormat.DoubleFormat(ap.elevator[i, lr].baseWingBlock.k_stall, 4); // g.DrawString(str_4, xx, y); y += dy; } } } y += 3; for (i = 0; i < ap.n_aileron; i++) { for (lr = 0; lr <= 1; lr++) { if (ap.aileron[i, lr].type != 0) { String str_5 = "A" + i + AirPlane.lrName[lr] + ": " + DispFormat.DoubleFormat(ap.aileron[i, lr].baseWingBlock.k_stall, 4); // g.DrawString(str_5, xx, y); y += dy; } } } y += 3; for (i = 0; i < ap.n_rudder; i++) { for (lr = 0; lr <= 1; lr++) { if (ap.rudder[i, lr].type != 0) { String str_6 = "R" + i + AirPlane.lrName[lr] + ": " + DispFormat.DoubleFormat(ap.rudder[i, lr].baseWingBlock.k_stall, 4); // g.DrawString(str_6, xx, y); y += dy; } } } //g.SetColor(Java.Awt.Color.green); //g.SetFont(new Font("Sansserif", 10)); dr.DrawAxis(g, 2.0D); double scale = 1.0D / ap.inp.m; for (i = 0; i < ap.n_wing; i++) { for (lr = 0; lr < ap.wing[i].n_lr; lr++) { for (int j_7 = 0; j_7 < ap.wing[i].n_wing_block; j_7++) { dr.DrawVector(g, ap.wing[i].wp[j_7, lr].ac, ap.wing[i].wp[j_7, lr].fv.SclProd(scale), "W" + j_7 + AirPlane.lrName[lr]); } } } for (i = 0; i < ap.n_htail; i++) { for (lr = 0; lr < ap.htail[i].n_lr; lr++) { for (int j_8 = 0; j_8 < ap.htail[i].n_wing_block; j_8++) { dr.DrawVector(g, ap.htail[i].wp[j_8, lr].ac, ap.htail[i].wp[j_8, lr].fv.SclProd(scale), "H" + AirPlane.lrName[lr]); } } } for (i = 0; i < ap.n_vtail; i++) { for (lr = 0; lr < ap.vtail[i].n_lr; lr++) { for (int j_9 = 0; j_9 < ap.vtail[i].n_wing_block; j_9++) { dr.DrawVector(g, ap.vtail[i].wp[j_9, lr].ac, ap.vtail[i].wp[j_9, lr].fv.SclProd(scale), "V" + AirPlane.lrName[lr]); } } } for (i = 0; i < ap.n_elevator; i++) { for (lr = 0; lr <= 1; lr++) { if (ap.elevator[i, lr].type != 0) { dr.DrawVector(g, ap.elevator[i, lr].baseWingBlock.ac, ap.elevator[i, lr].d_fv.SclProd(scale), "E" + AirPlane.lrName[lr]); } } } for (i = 0; i < ap.n_aileron; i++) { for (lr = 0; lr <= 1; lr++) { if (ap.aileron[i, lr].type != 0) { dr.DrawVector(g, ap.aileron[i, lr].baseWingBlock.ac, ap.aileron[i, lr].d_fv.SclProd(scale), "A" + AirPlane.lrName[lr]); } } } for (i = 0; i < ap.n_rudder; i++) { for (lr = 0; lr <= 1; lr++) { if (ap.rudder[i, lr].type != 0) { dr.DrawVector(g, ap.rudder[i, lr].baseWingBlock.ac, ap.rudder[i, lr].d_fv.SclProd(scale), "R" + AirPlane.lrName[lr]); } } } for (i = 0; i < ap.n_t_flap; i++) { for (lr = 0; lr <= 1; lr++) { if (ap.t_flap[i, lr].type != 0) { dr.DrawVector(g, ap.t_flap[i, lr].baseWingBlock.ac, ap.t_flap[i, lr].d_fv.SclProd(scale), "F" + AirPlane.lrName[lr]); } } } for (i = 0; i < ap.n_fuselage; i++) { for (lr = 0; lr <= 1; lr++) { if (ap.fuslage[i, lr].flag != 0) { dr.DrawVector(g, ap.fuslage[i, lr].ac, ap.fuslage[i, lr].fv.SclProd(scale), "F" + i + AirPlane.lrName[lr]); } } } for (i = 0; i < ap.n_LandingGear; i++) { for (lr = 0; lr <= 1; lr++) { if (ap.landing_gear[i, lr].flag == 0) { continue; } dr.DrawVector(g, ap.landing_gear[i, lr].pg, ap.landing_gear[i, lr].n_fv.SclProd(scale), "G" + i + AirPlane.lrName[lr]); dr.DrawVector(g, ap.landing_gear[i, lr].pg, ap.landing_gear[i, lr].f_fv.SclProd(scale), ""); dr.DrawVector(g, ap.landing_gear[i, lr].pa, ap.landing_gear[i, lr].a_fv.SclProd(scale), "G" + i + AirPlane.lrName[lr]); } } for (i = 0; i < ap.n_powerPlant; i++) { dr.DrawVector(g, ap.powerPlant[i].engine.GetPos(), ap.t_force.SclProd(scale), "E" + i); // g.SetColor(Java.Awt.Color.blue); if (ap.powerPlant[i].engine_type == 1) { dr.DrawVector(g, ((ReciprocatingEngine)ap.powerPlant[i].engine).ac, ((ReciprocatingEngine)ap.powerPlant[i].engine).wash_direction.SclProd(-5.0D), "WASH" + i); } } //g.SetColor(Color.Yellow); //g.SetFont(new Font("Sansserif", 10)); dr.DrawAxis(g, 2.0D); for (i = 0; i < ap.n_wing; i++) { for (lr = 0; lr < ap.wing[i].n_lr; lr++) { for (int j_10 = 0; j_10 < ap.wing[i].n_wing_block; j_10++) { dr.DrawVector(g, ap.wing[i].wp[j_10, lr].ac, ap.wing[i].wp[j_10, lr].vd.SclProd(0.03D), "W" + j_10 + AirPlane.lrName[lr]); } } } for (i = 0; i < ap.n_htail; i++) { for (lr = 0; lr < ap.htail[i].n_lr; lr++) { for (int j_11 = 0; j_11 < ap.htail[i].n_wing_block; j_11++) { dr.DrawVector(g, ap.htail[i].wp[j_11, lr].ac, ap.htail[i].wp[j_11, lr].vd.SclProd(0.03D), "H" + AirPlane.lrName[lr]); } } } for (i = 0; i < ap.n_vtail; i++) { for (lr = 0; lr < ap.vtail[i].n_lr; lr++) { for (int j_12 = 0; j_12 < ap.vtail[i].n_wing_block; j_12++) { dr.DrawVector(g, ap.vtail[i].wp[j_12, lr].ac, ap.vtail[i].wp[j_12, lr].vd.SclProd(0.03D), "V" + AirPlane.lrName[lr]); } } } for (i = 0; i < ap.n_elevator; i++) { for (lr = 0; lr <= 1; lr++) { if (ap.elevator[i, lr].type != 0) { dr.DrawVector(g, ap.elevator[i, lr].baseWingBlock.ac, ap.elevator[i, lr].baseWingBlock.vd.SclProd(0.03D), "E" + AirPlane.lrName[lr]); } } } for (i = 0; i < ap.n_aileron; i++) { for (lr = 0; lr <= 1; lr++) { if (ap.aileron[i, lr].type != 0) { dr.DrawVector(g, ap.aileron[i, lr].baseWingBlock.ac, ap.aileron[i, lr].baseWingBlock.vd.SclProd(0.03D), "A" + AirPlane.lrName[lr]); } } } for (i = 0; i < ap.n_rudder; i++) { for (lr = 0; lr <= 1; lr++) { if (ap.rudder[i, lr].type != 0) { dr.DrawVector(g, ap.rudder[i, lr].baseWingBlock.ac, ap.rudder[i, lr].baseWingBlock.vd.SclProd(0.03D), "R" + AirPlane.lrName[lr]); } } } for (i = 0; i < ap.n_fuselage; i++) { for (lr = 0; lr <= 1; lr++) { dr.DrawVector(g, ap.fuslage[i, lr].ac, ap.fuslage[i, lr].vd.SclProd(0.03D), "FUS" + i + AirPlane.lrName[lr]); } } // g.SetColor(Java.Awt.Color.black); // g.DrawString("TIRE M: " + PrintVal(ap.landing_gear[0, 0].tire.muX) + "/" + PrintVal(ap.landing_gear[0, 0].tire.muY), 150, 312); // g.DrawString("TIRE F': " + PrintVal(ap.landing_gear[0, 0].f_fv.x) + "/" + PrintVal(ap.landing_gear[0, 0].f_fv.y) + "/" + PrintVal(ap.landing_gear[0][0].f_fv.z), 150, 324); // g.DrawString("FLAG LAND': " + ap.flag_land, 150, 336); // g.SetColor(Color.Red); if (ap.n_htail > 0) { for (lr = 0; lr < ap.htail[0].n_lr; lr++) { dr.DrawVector(g, ap.htail[0].wp[0, lr].ac, ap.interference.htail_dv[lr].SclProd(-0.03D), "IH" + i + AirPlane.lrName[lr]); } } if (ap.n_vtail > 0) { for (lr = 0; lr < ap.vtail[0].n_lr; lr++) { dr.DrawVector(g, ap.vtail[0].wp[0, lr].ac, ap.interference.vtail_dv[lr].SclProd(-0.03D), "IV" + i + AirPlane.lrName[lr]); } } for (i = 0; i < ap.n_fuselage; i++) { for (lr = 0; lr <= 1; lr++) { if (ap.fuslage[i, lr].flag != 0) { dr.DrawVector(g, ap.fuslage[i, lr].ac, ap.interference.fuselage_dv[i, lr].SclProd(-0.03D), "IF" + i + AirPlane.lrName[lr]); } } } }
public VsObject MakeGrid(BoundingBox bbox, double dist, double viewAngle) { double range_base = bbox.XSize(); if (range_base < bbox.ZSize()) { range_base = bbox.ZSize(); } double k = dist / (bbox.DiagonalSize() / 2D / System.Math.Tan(MathTool.DegToRad(viewAngle) / 2D)); range_base *= k; grid_scale = Kizami(range_base); if (grid_scale < 50D) { grid_scale = 50D; } xs = Start(bbox.GetMinX() - 10D, grid_scale); xe = End(bbox.GetMaxX() + 10D, grid_scale); zs = Start(bbox.GetMinZ() - 10D, grid_scale); ze = End(bbox.GetMaxZ() + 10D, grid_scale); ys = Y_base(bbox); Vector3D v1 = new Vector3D(xs, 0.0D, zs); Vector3D v2 = new Vector3D(xe, 0.0D, zs); Vector3D v3 = new Vector3D(xe, 0.0D, ze); Vector3D v4 = new Vector3D(xs, 0.0D, ze); Vector3D v5 = new Vector3D(xs, ys, zs); Vector3D v6 = new Vector3D(xe, ys, zs); Vector3D v7 = new Vector3D(xe, ys, ze); Vector3D v8 = new Vector3D(xs, ys, ze); VsPolygon groundPol = new VsPolygon(); groundPol.col = groundcCol; groundPol.pol.AddVertex(v1); groundPol.pol.AddVertex(v2); groundPol.pol.AddVertex(v3); groundPol.pol.AddVertex(v4); grid = new VsObject(); grid.Add(groundPol); grid.Add(Jp.Maker1.Vsys3.Tools.BasicObject.XzGlid(0.0D, xs, zs, xe, ze, grid_scale, grid_scale, groundGridCol)); if (ys > 0.0D) { grid.Add(new VsSegment(v1, v5, yBaseGridCol)); grid.Add(new VsSegment(v2, v6, yBaseGridCol)); grid.Add(new VsSegment(v3, v7, yBaseGridCol)); grid.Add(new VsSegment(v4, v8, yBaseGridCol)); VsPolygon basePol = new VsPolygon(); basePol.col = yBaseCol; basePol.pol.AddVertex(v5); basePol.pol.AddVertex(v6); basePol.pol.AddVertex(v7); basePol.pol.AddVertex(v8); grid.Add(basePol); grid.Add(Jp.Maker1.Vsys3.Tools.BasicObject.XzGlid(ys, xs, zs, xe, ze, grid_scale, grid_scale, yBaseGridCol)); } grid.Add(new VsString(DispFormat.DoubleFormat(ys, 0) + "m", v5, Color.Gray, smallFont)); grid.Add(new VsString(DispFormat.DoubleFormat(ys, 0) + "m", v6, Color.Gray, smallFont)); grid.Add(new VsString(DispFormat.DoubleFormat(ys, 0) + "m", v7, Color.Gray, smallFont)); grid.Add(new VsString(DispFormat.DoubleFormat(ys, 0) + "m", v8, Color.Gray, smallFont)); grid.Add(new VsString("NORTH", v7.Add(v8).SclProd(0.5D), Color.Gray, smallFont)); grid.Add(new VsString("SOUTH", v5.Add(v6).SclProd(0.5D), Color.Gray, smallFont)); grid.Add(new VsString("WEST", v8.Add(v5).SclProd(0.5D), Color.Gray, smallFont)); grid.Add(new VsString("EAST", v7.Add(v6).SclProd(0.5D), Color.Gray, smallFont)); return(grid); }
public void Print() { System.Console.Out.Write("[R:" + DispFormat.DoubleFormat(red, 1)); System.Console.Out.Write("/G:" + DispFormat.DoubleFormat(green, 1)); System.Console.Out.Write("/B:" + DispFormat.DoubleFormat(blue, 1) + "]"); }