Mapping between Scene and Screen
Screen (0, W-1) (W-1, H-1) (W-1, 0)(0, 0) Projection Plane (Xmin, Ymin)(Xmax, Ymin) (Xmax, Ymax) (Xmin, Ymax) Screen Dimension W x H
(0, W-1) (W-1, H-1) (W-1, 0)(0, 0) (Xmin, Ymin)(Xmax, Ymin) (Xmax, Ymax) (Xmin, Ymax) Projection Plane Screen (x, y) (X, Y) Due to the same proportion: x / (W-1) = (X – Xmin)/ (Xmax – Xmin) y / (H-1) = (Ymax – Y)/ (Ymax – Ymin)
(0, W-1) (W-1, H-1) (W-1, 0)(0, 0) (Xmin, Ymin)(Xmax, Ymin) (Xmax, Ymax) (Xmin, Ymax) Projection Plane Screen (x, y) (X, Y) Due to the same proportion: x’ = x / (W-1) = (X – Xmin)/ (Xmax – Xmin) y’ = y / (H-1) = (Ymax – Y)/ (Ymax – Ymin) Xmin = Ymin = -1 Xmax = Ymax = 1 2 x’ = (X +1), X = 2x’ y’ = 1 – Y,Y = 1 – 2y’ Case One: CEGUI
(0, -1) (1, -1) (1, 0)(0, 0) (Xmin, Ymin)(Xmax, Ymin) (Xmax, Ymax) (Xmin, Ymax) Projection Plane Screen (x, y) (X, Y) Due to the same proportion: x’ = x / (W-1) = (X – Xmin)/ (Xmax – Xmin) -y’ = y / (H-1) = (Y - Ymin)/ (Ymax – Ymin) Xmin = Ymin = -1 Xmax = Ymax = 1 2 x’ = (X +1), X = 2x’ – 1 -2y’ = (Y+1),Y = y’ Case Two: “Upside down image” (TrayMng)