/// <summary> /// Calculates a mesh for an RLD surface. /// </summary> private static Mesh SurfaceInternal(out RLD_outputs outputs) { Mesh mesh = new Mesh(); Func <double, double, double, Vector3D[]> oneCircle = (x, o, scale) => { Vector3D normal = Normal(x, o * scale); Vector3D cen = new Vector3D(0, 0, normal.Z); Vector3D radius = new Vector3D(normal.X, 0); return(Shapeways.Disk(cen, new Vector3D(0, 0, 1), radius, m_params.Res)); }; outputs = RLD_Sphere(m_params.K); double s = m_params.Scale; //double s = outputs.scale; // Add in two bands for each segment along the profile, one for +z coords, and one for -z coords. Vector3D[] profile = outputs.profile; for (int i = 0; i < profile.Length - 1; i++) { Vector3D p1 = profile[i]; Vector3D p2 = profile[i + 1]; mesh.AddBand(oneCircle(p1.X, p1.Y, s), oneCircle(p2.X, p2.Y, s)); mesh.AddBand(oneCircle(p1.X, -p1.Y, s), oneCircle(p2.X, -p2.Y, s)); } return(mesh); }
// Returns the profile for the RLD surface. // First component is the X value, second component is the offset. private static RLD_outputs RLD_Sphere(int k) { RLD_Calculator calc = new RLD_Calculator(k); calc.Calc(); RLD_outputs outputs = new RLD_outputs(); outputs.profile = calc.ProfileS3(); outputs.phi_i = calc.s_i.Select(s => calc.Phi(s)).ToArray(); outputs.x_i = calc.s_i.Select(s => CylToSphere(s)).ToArray(); outputs.t_i = calc.t_i(); outputs.scale = outputs.t_i[1] * m_params.M / (calc.Phi(calc.s_i[1]) * calc.Flux); return(outputs); }