Example #1
0
        public static Position3D ProjectCanvasToSceneSystem(double canvasX, double canvasY, double canvasWidth, double canvasHeight, double nearPlaneDist, Matrix44D cameraFrame)
        {
            var(x, y) = ViewProjection.ProjectCanvasToCameraPlane(canvasX, canvasY, canvasWidth, canvasHeight);
            var posCameraSystem = ViewProjection.ProjectCameraPlaneToCameraSystem(x, y, nearPlaneDist);
            var posSceneSystem  = ViewProjection.ProjectCameraSystemToSceneSystem(posCameraSystem, cameraFrame);

            return(posSceneSystem);
        }
Example #2
0
        public static Position3D ProjectCameraSystemToSceneSystem(this Position3D position, Matrix44D cameraFrame)
        {
            var scenePosition = cameraFrame * position;

            return(scenePosition);
        }
Example #3
0
        public static Position3D ProjectSceneSystemToCameraSystem(this Position3D position, Matrix44D cameraFrame)
        {
            var cameraPosition = cameraFrame.Inverse() * position;

            return(cameraPosition);
        }
Example #4
0
        public static (double canvasX, double canvasY) ProjectSceneSystemToCanvas(Position3D position, double canvasWidth, double canvasHeight, double nearPlaneDist, Matrix44D cameraFrame)
        {
            var cameraSystemPos = ProjectSceneSystemToCameraSystem(position, cameraFrame);

            var(cameraPlaneX, cameraPlaneY) = ProjectCameraSystemToCameraPlane(cameraSystemPos, nearPlaneDist);
            var(canvasX, canvasY)           = ProjectCameraPlaneToCanvas(cameraPlaneX, cameraPlaneY, canvasWidth, canvasHeight);
            return(canvasX, canvasY);
        }