private void CreateModel() { const double dt = 0.1; const int nSteps = 100; var mb = new MeshBuilder(true, true); for (double y0 = -5; y0 <= 5; y0 += 0.25) { var p0 = new Point(-3, y0); Point[] pts = Solve(Velocity, p0, dt, nSteps); var vel = new double[pts.Length]; var diam = new double[pts.Length]; int i = 0; var pts3d = new Point3D[pts.Length]; double vmax = 0; foreach (Point pt in pts) { pts3d[i] = new Point3D(pt.X, pt.Y, 0); double v = Velocity(pt.X, pt.Y).Length; if (v > vmax) vmax = v; vel[i++] = v; } for (int j = 0; j < vel.Length; j++) vel[j] /= vmax; for (int j = 0; j < vel.Length; j++) diam[j] = 0.075; mb.AddTube(pts3d, vel, diam, 12, false); } StreamLinesModel = new GeometryModel3D(); StreamLinesModel.Geometry = mb.ToMesh(); StreamLinesModel.Material = Materials.Hue; StreamLinesModel.BackMaterial = Materials.Hue; }
protected override MeshGeometry3D Tessellate() { var builder = new MeshBuilder(); builder.AddTube(Path, null, null, Section, IsPathClosed, IsSectionClosed); return builder.ToMesh(); }