The center is left+1/2 width The width of the view volume is (right-left) So 1/2 of this, the distance from the left endpoint to the center is (right-left)/2 So the center of the x distance is cx = left + 1/2(right-left) = 2/2left + 1/2(right-left) = 1/2(2left + right - left) = 1/2(left+right)
| 1 0 0 -cx | | 0 1 0 -cy | T = | 0 0 1 -cz | | 0 0 0 1 |
The current width is right-left If we multiply by 1/(right-left) the length will become 1. We want to divide by 1/2 that so sx = 1/(right-left)/2 = 2/(right-left)
| sx 0 0 0 | | 0 sy 0 0 | S = | 0 0 sz 0 | | 0 0 0 1 |
| sx 0 0 0 | | 0 sy 0 0 | S'= | 0 0 -sz 0 | | 0 0 0 1 |
| sx 0 0 0 | | 1 0 0 -cx | | sx 0 0 sx(-cx) | | 0 sy 0 0 | | 0 1 0 -cy | | 0 sy 0 sy(-cy) | S'T= | 0 0 -sz 0 | | 0 0 1 -cz | = | 0 0 -sz sz(-cz) | | 0 0 0 1 | | 0 0 0 1 | | 0 0 0 1 |
sx 0 0 sx(-cx) = 2/(right-left) (-1/2)(right+left) = -(right+left)/(right-left) = (right+left)/(left-right)
| 2 right+left | | ---------- 0 0 ---------- | | right-left left-right | | | | 2 top+bottom | | 0 ---------- 0 ---------- | | top-bottom bottom-top | | | | 2 far+near | | 0 0 -------- -------- | | near-far near-far | | | | 0 0 0 1 |
| 1 0 0 0 | | 0 1 0 0 | | 0 0 0 0 | | 0 0 0 1 |