Blender Python revert view pan and rotate for vertex I want to bring a vertex to the zero position for a certain axis (x or Y), the vertex is on a special plane (not an object, a stored viewplane) so I tried to use the stored view matrix, set it to 0 for an axis and then tried to rotate it back.
rot_mat = self._view_context._view_mat # This is stored from Region3d.view_matrix. 

v = rot_mat @ vec_center

if axis == &quot;X&quot;:
 v = Vector((-v[0],0,0)) # Difference in X location
elif axis == &quot;Y&quot;:
 v = Vector((0,-v[1],0)) # Difference in Y location

vec_center += rot_mat.inverted() @ v

It works, but not, if the view is panned. How can I take the translation of the viewport into acount as well?
Found it, the view_matrix contains the translation as well, have to get the 3x3 matrix only:
rot_mat = self._view_context._view_mat.to_3x3()