A clarification regarding page.GetDefaultMatrix()

Q: We are trying to use the page.GetDefaultMatrix() to crop points.

From the API documentation, I am under the impression that the

following:

Page.GetDefaultMatrix(false, Page.Box.e_crop)

should produce a matrix that will crop points to the crop box. For
instance, if my crop box is Rect(0, 0, 10, 10) and my point is (5, 12)
then multiplying my point by the above matrix should result in a point
that is within the crop box. In this case, it would be the
intersection of the line {start point, (5, 12)} and line {(0, 10),
(10, 10)}. Am I understanding this correctly? I ask because we only
get the identity matrix from the above method call, unless there is a
page rotation.
-----
A: The transformation matrix returned by page.GetDefaultMatrix() does
not clip the transformed points to the crop box.

So if the crop box is Rect(0, 0, 10, 10) and there is no additional
page rotation, GetDefaultMatrix() will return identity matrix. If the
page crop box was Rect(-10, -10, 0, 0), the transformation matrix
would be Matrix2D(1, 0, 0, 1, -10, -10). So GetDefaultMatrix() will
transform your point relative to the origin of the crop box (i.e. from
[5,12] to [-5, 2]).

The main point is that the crop (or media) box rectangle in the page
dictionary does not necessarily start at (0, 0).

In case you would like also to clip the point to the crop box you can
check if the transfromed point is in the crop box using
page.GetCropBox().Contains(pt_x, pt_y) .