Пример #1
0
        //Assume that screen is square
        public static double GetActualScreenSize(double distanceFromCamToScreen, double fov)
        {
            double rad  = MathCalculations.DegreeToRad(fov);
            double size = 2 * distanceFromCamToScreen * Math.Tan(rad / 2);

            return(size);
        }
Пример #2
0
        public override Image RenderObj(string inputPath)
        {
            #region CameraSettings
            Vector3 centerScreen     = Camera.Origin + new Vector3(0, 0, 1);
            Vector3 camLookDirection = (centerScreen - Camera.Origin).Normalize();
            Image   image            = new Image(1000, 1000);
            #endregion
            _actualScreenSize = MathCalculations.GetActualScreenSize((Camera.Origin - centerScreen).Length, 90);

            List <Triangle> renderObject         = GetModel(inputPath);
            List <Vector3>  arrayOfPixelsCenters = GetScreenPointsForRay(_actualScreenSize, image);
            IRay[,] rays       = GetRays(Camera, arrayOfPixelsCenters, image);
            image.ImagePalette = GetRayIntersactionWithModel(rays, renderObject);
            return(image);
        }