public void Given_triangle_points(string id,
                                   double p1X, double p1Y, double p1Z,
                                   double p2X, double p2Y, double p2Z,
                                   double p3X, double p3Y, double p3Z)
 {
     figure[id] = new TriangleFigure(MatrixOperations.Identity(4),
                                     MaterialConstants.Default,
                                     Tuple4.Point(p1X, p1Y, p1Z),
                                     Tuple4.Point(p2X, p2Y, p2Z),
                                     Tuple4.Point(p3X, p3Y, p3Z));
 }
 public void Point_id(string id, double t1, double t2, double t3)
 {
     tuple[id] = Tuple4.Point(t1, t2, t3);
 }
 public void Then_point(string a, double t1, double t2, double t3)
 {
     Assert.Equal(Tuple4.Point(t1, t2, t3), tuple[a]);
 }
 public void When_world_to_object(string a, string s, double t1, double t2, double t3)
 {
     tuple[a] = ((BaseFigure)figure[s]).TransformWorldPointToObjectPoint(Tuple4.Point(t1, t2, t3));
 }
 public void Then_saved_ray_origin(string a, double t1, double t2, double t3)
 {
     Assert.Equal(Tuple4.Point(t1, t2, t3), ((TestFigure)figure[a]).SavedRay.origin);
 }
示例#6
0
 public void Point_id(string id, double t1, double t2, double t3)
 {
     tuple.Add(id, Tuple4.Point(t1, t2, t3));
 }
示例#7
0
 private Tuple4 ReadVertex(string[] parts)
 {
     return(Tuple4.Point(ReadDouble(parts[1]), ReadDouble(parts[2]), ReadDouble(parts[3])));
 }
        public static BaseScene CreateDefault()
        {
            var defaultMaterial = MaterialConstants.Default;
            var defaultWorld    = new BaseScene()
                                  .WithFigures(
                new SphereFigure(
                    Matrix4x4.Identity,
                    new SolidColorMaterial(new Tuple4(0.8, 1.0, 0.6, TupleFlavour.Vector),
                                           defaultMaterial.Ambient,
                                           0.7,
                                           0.2,
                                           defaultMaterial.Shininess,
                                           defaultMaterial.Reflective,
                                           defaultMaterial.RefractiveIndex,
                                           defaultMaterial.Transparency)),
                new SphereFigure(
                    MatrixOperations.Geometry3D.Scale(0.5, 0.5, 0.5),
                    defaultMaterial)
                )
                                  .WithLights(new SpotLight(ColorModel.WhiteNormalized, Tuple4.Point(-10, 10, -10), 1.0),
                                              new AmbientLight(1.0))
                                  .WithShadows(true)
                                  .WithColorModel(ColorModel.WhiteNormalized);

            return(defaultWorld);
        }
 public void Given_ray(string id,
                       double p1, double p2, double p3,
                       double v1, double v2, double v3)
 {
     ray[id] = new Ray(Tuple4.Point(p1, p2, p3), Tuple4.Vector(v1, v2, v3));
 }
 public void Then_hit_point(double x, double y, double z)
 {
     Assert.Equal(Tuple4.Point(x, y, z), hit[ComputationsId].PointOnSurface);
 }
 public void Given_ray(string id, double p1, double p2, double p3, string dId)
 {
     ray[id] = new Ray(Tuple4.Point(p1, p2, p3), tuple[dId]);
 }
 public void Given_local_normal_at(string id, string fId, double p1, double p2, double p3)
 {
     tuple[id] = ((TestCone)figure[fId]).GetLocalNormal(null, Tuple4.Point(p1, p2, p3));
 }
示例#13
0
 public void Then_parser_vertex(string id, int i, double x, double y, double z)
 {
     Assert.Equal(Tuple4.Point(x, y, z), parser[id].Vertices[i - 1]);
 }
示例#14
0
 public void Given_local_normal_at(string id, string fId, double p1, double p2, double p3)
 {
     tuple[id] = figure[fId].GetNormal(null, Tuple4.Point(p1, p2, p3));
 }
 public void Then_pattern_at_color(string id, double x, double y, double z, double r, double g, double b)
 {
     Assert.Equal(Tuple4.Vector(r, g, b), patterns[id].GetColor(Tuple4.Point(x, y, z)));
 }