public void setOrigin(final int win_x, final int win_y) { final float[] in = { win_x * m_delta.get(0) + m_constant.get(0), win_y * m_delta.get(1) + m_constant.get(1) }; final float[] center = { m_inverse.get(0, 0) * in[0] + m_inverse.get(0, 1) * in[1] + m_inverse.get(0, 3), m_inverse.get(1, 0) * in[0] + m_inverse.get(1, 1) * in[1] + m_inverse.get(1, 3), m_inverse.get(2, 0) * in[0] + m_inverse.get(2, 1) * in[1] + m_inverse.get(2, 3), m_inverse.get(3, 0) * in[0] + m_inverse.get(3, 1) * in[1] + m_inverse.get(3, 3) }; float[] front = { center[0] - m_inverse.get(0, 2), center[1] - m_inverse.get(1, 2), center[2] - m_inverse.get(2, 2), center[3] - m_inverse.get(3, 2) }; final float front_inv = 1.0f / front[3]; front[0] *= front_inv; front[1] *= front_inv; front[2] *= front_inv; float[] back = { center[0] + m_inverse.get(0, 2), center[1] + m_inverse.get(1, 2), center[2] + m_inverse.get(2, 2), center[3] + m_inverse.get(3, 2) }; final float back_inv = 1.0f / back[3]; back[0] *= back_inv; back[1] *= back_inv; back[2] *= back_inv; m_t = 0.0f; m_from = new Vector3f(front[0], front[1], front[2]); Vector3f direction = new Vector3f(back[0] - front[0], back[1] - front[1], back[2] - front[2]); m_direction = direction.normalize(); }