public void MakePlane(AirPlane ap, Material mate, Material mate2) { Matrix44 smat = new Matrix44(); Matrix44 rmat = new Matrix44(); Matrix44 tmat = new Matrix44(); smat.SetSMat(ap.plane.width, ap.plane.length, 0.0D); tmat.SetTMat(0.0D, -ap.plane.length / 2.0D + ap.plane.x_offset, 0.0D); rmat.SetRxMat(MathTool.DegToRad(90.0D)); VsPolygon4 tripol = (VsPolygon4)Jp.Maker1.Vsys3.Tools.BasicObject.RegularPolygonM2(3, mate, mate2).Transform(smat); plane.Add(tripol.Transform(tmat).Transform(rmat)); }
public VsObject MakeWall(Recorder rec, double y, Color col) { VsObject wall = new VsObject(); int n = rec.N_record(); if (n > 0) { wall.Add(Suisen(rec.GetData(0), y, col)); wall.Add(Suisen(rec.GetData(n - 1), y, col)); } int step = n / 10; if (step > 0) { for (int i = step; i < n; i += step) { RecordData dat = rec.GetData(i); wall.Add(Suisen(dat, y, col)); } } return(wall); }
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 void MakeLocus(Recorder rec, AirPlane ap) { Matrix44 rmat = new Matrix44(); Matrix44 tmat = new Matrix44(); int n = rec.N_record(); for (int i = 0; i < n; i++) { RecordData dat = rec.GetData(i); rmat.SetRMatL_RPY(dat.roll.GetValue(), dat.pitch.GetValue(), dat.yaw.GetValue()); tmat.SetTMat(dat.wpos.x, dat.wpos.y, dat.wpos.z); locus.Add(plane.Transform(rmat).Transform(tmat)); } locusBBox = locus.BoundingBox(); }
public VsObject MakeXZLocus(Recorder rec, double y, Color col) { VsObject xzLocus = new VsObject(); Vector3D v1 = new Vector3D(); Vector3D v2 = new Vector3D(); int n = rec.N_record(); for (int i = 0; i < n; i++) { RecordData dat = rec.GetData(i); if (i > 0) { v1.SetVec(dat.wpos); v2.SetVec(rec.GetData(i - 1).wpos); v1.y = (v2.y = y); xzLocus.Add(new VsSegment(v1, v2, col)); } } return(xzLocus); }
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 VsObject MakeEarth(Vector3D pos) { VsObject ret = new VsObject(); Matrix44 smat = new Matrix44(); Matrix44 mtemp = new Matrix44(); double r = 6370000.0D; double x = pos.x; double y = pos.y; double z = pos.z; double h = Math.Abs(y); double scale; if (h != 0.0D) { scale = 2.0D * h * r / Math.Sqrt(h * h + 2.0D * h * r); } else { scale = 1.0D; } smat.SetSMat(scale, scale, scale); mtemp.SetTMat(x, 0.0D, z); ret.Add(earth.Transform(smat).Transform(mtemp)); if (y > 2300.0D) { scale = 10000.0D; double tx = x - (x / scale - Math.Floor(x / scale)) * scale; double tz = z - (z / scale - Math.Floor(z / scale)) * scale; mtemp.SetTMat(tx, 0.0D, tz); ret.Add(glid10km.Transform(mtemp)); } scale = 1000.0D; double tx_0 = x - (x / scale - Math.Floor(x / scale)) * scale; double tz_1 = z - (z / scale - Math.Floor(z / scale)) * scale; mtemp.SetTMat(tx_0, 0.0D, tz_1); ret.Add(glid1km.Transform(mtemp)); if (y < 2700.0D) { scale = 100.0D; tx_0 = x - (x / scale - Math.Floor(x / scale)) * scale; tz_1 = z - (z / scale - Math.Floor(z / scale)) * scale; mtemp.SetTMat(tx_0, 0.0D, tz_1); ret.Add(glid100m.Transform(mtemp)); } if (y < 270.0D) { scale = 10.0D; tx_0 = x - (x / scale - Math.Floor(x / scale)) * scale; tz_1 = z - (z / scale - Math.Floor(z / scale)) * scale; mtemp.SetTMat(tx_0, 0.0D, tz_1); ret.Add(glid10m.Transform(mtemp)); } ret.Add(runway); if (y < 270.0D) { ret.Add(glid_runway); } return(ret); }