public Locus(AirPlane ap, Recorder rec, Material mate, Material mate2) { plane = new VsObject(); locus = new VsObject(); groundLocus = new VsObject(); ybaseLocus = new VsObject(); MakePlane(ap, mate, mate2); MakeLocus(rec, ap); groundLocus = MakeXZLocus(rec, 0.0D, Color.Black); double y_base = LocusGrid.Y_base(locusBBox); if (y_base > 0.0D) { ybaseLocus = MakeXZLocus(rec, y_base, Color.Gray); ybaseLocus.Add(MakeWall(rec, y_base, Color.Gray)); } }
public LocusViewer(double sX0, double sY0, double sX1, double sY1, AirPlane ap, Recorder rec) { planeM = new Material(new LightColor(0.0D, 0.0D, 0.6D), new LightColor(0.5D, 0.5D, 0.5D), 10.0D, new LightColor(0.0D, 0.0D, 0.0D)); planeM2 = new Material(new LightColor(0.6D, 0.0D, 0.0D), new LightColor(0.5D, 0.5D, 0.5D), 10.0D, new LightColor(0.0D, 0.0D, 0.0D)); light = Jp.Maker1.Vsys3.Tools.Light.Parallel(new LightColor(255.0D, 255.0D, 255.0D), new Vector3D(0.5D, -0.5D, 1.0D)); amblight = Jp.Maker1.Vsys3.Tools.Light.Ambience(new LightColor(128.0D, 128.0D, 128.0D)); infoCol = Color.FromArgb(64, 64, 64); dataCol = Color.Gray; cursolCol = Color.FromArgb(255, 0, 0); suisenCol = Color.Gray; stdFont = new Font("SansSelif", 12); smallFont = new Font("SansSelif", 11); sc = new Scine(); oa = new OpticalAmbience(); viewAngle = 25.0D; grid = new LocusGrid(); rmat = new Matrix44(); tmat = new Matrix44(); mat_bef = new Matrix44(); mat = new Matrix44(); moveingTime = 5.0D; rotationTime = 7.0D; currentDataIndex = 0; proj = new Projector(sX1 - sX0 + 1.0D, sY1 - sY0 + 1.0D, MathTool.DegToRad(25.0D)); clip = new Clipper(sX0, sY0, sX1, sY1); oa.AddLight(light); oa.AddLight(amblight); recorder = rec; locus = new Locus(ap, rec, planeM, planeM2); InitDispParam(); fastMoveStep = (recorder.N_record() / 50); if (fastMoveStep <= 0) { fastMoveStep = 1; } }
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; } }