예제 #1
0
파일: Object.cs 프로젝트: trcccc/RayTracing
        public Triangle(Vector Point1, Vector Point2, Vector Point3)
        {
            this.Point1 = Point1;
            this.Point2 = Point2;
            this.Point3 = Point3;
            var n1 = Point2 - Point1;
            var n2 = Point3 - Point1;

            Normal = Vector.Corss(ref n1, ref n2);
            Normal.Normalize();
        }
예제 #2
0
        public Camera(Vector Position, Vector Taget)
        {
            Vector forward = Taget - Position;

            forward.Normalize();
            Vector down  = new Vector(0, -1, 0);
            Vector right = Vector.Corss(ref forward, ref down);

            right.Normalize();
            right *= 2;
            Vector up = Vector.Corss(ref forward, ref right);

            up.Normalize();
            up *= 1.5f;

            this.Position  = Position;
            this.Direction = forward;
            this.Y         = up;
            this.X         = right;
        }