public void The_Z_coord_of_the_result_equals_the_minimum_of_the_Z_coords_of_the_two_points() { var left = new Point(.1, .2, .3); var right = new Point(.2, .1, 1.6); Assert.Equal(System.Math.Min(left.Z, right.Z), Point.ElementsMin(left, right).Z); }
public void RenderScene(RenderingContext context) { Ensure.That("context", context).IsNotNull(); //// transforms from image space into camera space //var imageMatrix = Matrix.Scaling(1d / context.Target.Width, 1d / context.Target.Height, 1); foreach (var pixel in context.Target.GetPixels()) { var colorAccumulator = Color.Black; foreach (var pixelSpaceSample in _pixelSampleGenerator.GenerateSamples(context.SamplesPerPixel)) { var imageSpaceSample = new Point(pixel.X + pixelSpaceSample.X, pixel.Y + pixelSpaceSample.Y, 1); var projectionSpaceRay = new Ray(context.ImageMatrix * imageSpaceSample, Vector.UnitZ); var cameraSpaceRay = context.ProjectionMatrix * projectionSpaceRay; // TODO: transform camera space ray into world space colorAccumulator += _algorithm.DetermineRayColor(cameraSpaceRay, context.World); } context.Target.SetPixelColor(pixel, colorAccumulator / context.SamplesPerPixel); } }
public Color GetColorAt(Point point) { return Color; }
public AxisAlignedBoundingBox(Point min, Point max) { Min = Point.ElementsMin(min, max); Max = Point.ElementsMax(min, max); }
public PointLight(Color emittedColor, Point position) { EmittedColor = emittedColor; Position = position; }
public Sphere(Point position, double radius) { Position = position; Radius = radius; }
public Triangle(Point a, Point b, Point c) { _a = a; _b = b; _c = c; }
public void The_identity_matrix_should_result_in_the_same_point() { var point = new Point(1, 2, 3); Assert.Equal(point, Matrix.Identity * point); }