public void Scene2() { var camera = new Camera(new Point3(5.0, 5.0, -5.0), new Point3(0.0, 0.0, 0.0), Vector3.UnitY, 1.0, // Short focal length picture.Width, picture.Height); scene.Camera = camera; scene.Antialias = true; var l = new Light(new Point3(7.0, 7.0, -7.0), // Position new Colour(1.0), // Colour 0.5); // Intensity scene.Add(l); // l = new Light(new Point(-1.0, 5.0, 3.0), // Position // new Colour(1.0), // Colour // 0.5); // Intensity // scene.Add(l); Material mat; Finish fin; fin = new Finish(0.6, 0.4, 0.4, 0.5); var blue = new Pigment(Colour.CornflowerBlue); mat = new Material(blue, fin); Solid s1 = new CylinderX(1.0, 1.0, mat); var orchid = new Pigment(Colour.Orchid); mat = new Material(orchid, fin); Solid s2 = new CylinderY(1.0, 1.0, mat); var pink = new Pigment(Colour.DeepPink); mat = new Material(pink, fin); Solid s3 = new CylinderZ(1.0, 1.0, mat); scene.Add(s1 | s2 | s3); var orange = new Pigment(Colour.Orange); fin = new Finish(0.3, 0.4, 10.0, 0.5); mat = new Material(orange, fin); mat.MakeTransparent(Colour.Gold, 1.3); Solid s = new Sphere(new Point3(0.0, 0.0, 0.0), 2.0, mat); scene.Add(s); }
private Solid Cylinder(Point3 a, Point3 b, double diameter) { Solid c = new CylinderX(diameter, diameter); var t = new Transform(); var along = b - a; if (along.Norm() < 0.001) { return(null); } var angle = Math.Atan2(b.y - a.y, b.x - a.x) * 180.0 / Math.PI; t.Rotate(Axis.Z, -angle); t.Translate(a); c.Apply(t); var p1 = new Plane(a, -along); var p2 = new Plane(b, along); c = c & p1; c = c & p2; return(c); }