Example #1
0
 public Sphere(Matrix transform)
 {
     Radius    = 1;
     Center    = PointType.Point(0, 0, 0);
     Transform = transform;
     Material  = new Material();
 }
Example #2
0
 public Sphere()
 {
     Radius    = 1;
     Center    = PointType.Point(0, 0, 0);
     Transform = Matrix.GetIdentity(4, 4);
     Material  = new Material();
 }
Example #3
0
 public Sphere(Material material)
 {
     Radius    = 1;
     Center    = PointType.Point(0, 0, 0);
     Material  = material;
     Transform = Matrix.GetIdentity(4, 4);
 }
Example #4
0
        public override BoundingBox Bounds()
        {
            var min = PointType.Point(-1, Minimum, -1);
            var max = PointType.Point(1, Maximum, 1);

            return(new BoundingBox(min, max));
        }
Example #5
0
        public void SubstractVectorFromPoint()
        {
            var p1  = PointType.Point(3, 2, 1);
            var v2  = PointType.Vector(5, 6, 7);
            var p   = PointType.Point(-2, -4, -6);
            var sub = p1 - v2;

            Assert.Equal(p, sub);
            Assert.True(sub.IsPoint);
        }
Example #6
0
        public void SubstractTwoPoints()
        {
            var p1  = PointType.Point(3, 2, 1);
            var p2  = PointType.Point(5, 6, 7);
            var v   = PointType.Vector(-2, -4, -6);
            var sub = p1 - p2;

            Assert.Equal(v, sub);
            Assert.True(sub.IsVector);
        }
Example #7
0
        public override BoundingBox Bounds()
        {
            var r = Math.Max(
                Math.Abs(Minimum),
                Math.Abs(Maximum));

            var min = PointType.Point(-r, Minimum, -r);
            var max = PointType.Point(r, Maximum, r);

            return(new BoundingBox(min, max));
        }
Example #8
0
        private void CalculatePath()
        {
            DrawCanvas.Children.Clear();

            var proj = new obj.Projectile(
                PointType.Point(0, 1, 0),
                PointType.Vector(1, 1, 0).Normalize() * inc);
            var env = new obj.Environment(
                PointType.Vector(0, -0.1, 0),
                PointType.Vector(-0.01, 0, 0));

            foreach (var coord in obj.Projectile.GetTick(env, proj))
            {
                DrawCircle(coord.X, coord.Y);
            }
        }
Example #9
0
 public static PointType Min(PointType a, PointType b, PointType c)
 {
     return(PointType.Point(Min(a.X, b.X, c.X), Min(a.Y, b.Y, c.Y), Min(a.Z, b.Z, c.Z)));
 }