1al_check_inverse(3) al_check_inverse(3)
2
3
4
6 al_check_inverse - Allegro 5 API
7
9 #include <allegro5/allegro.h>
10
11 int al_check_inverse(const ALLEGRO_TRANSFORM *trans, float tol)
12
14 Checks if the transformation has an inverse using the supplied toler‐
15 ance. Tolerance should be a small value between 0 and 1, with 1e-7 be‐
16 ing sufficient for most applications.
17
18 In this function tolerance specifies how close the determinant can be
19 to 0 (if the determinant is 0, the transformation has no inverse).
20 Thus the smaller the tolerance you specify, the “worse” transformations
21 will pass this test. Using a tolerance of 1e-7 will catch errors
22 greater than 1/1000’s of a pixel, but let smaller errors pass. That
23 means that if you transformed a point by a transformation and then
24 transformed it again by the inverse transformation that passed this
25 check, the resultant point should less than 1/1000’s of a pixel away
26 from the original point.
27
28 Note that this check is superfluous most of the time if you never
29 touched the transformation matrix values yourself. The only thing that
30 would cause the transformation to not have an inverse is if you applied
31 a 0 (or very small) scale to the transformation or you have a really
32 large translation. As long as the scale is comfortably above 0, the
33 transformation will be invertible.
34
35 Parameters:
36
37 • trans - Transformation to check
38
39 • tol - Tolerance
40
41 Returns: 1 if the transformation is invertible, 0 otherwise
42
43 Note: Allegro’s transformation inversion functions work correct‐
44 ly only with 2D transformations.
45
47 al_invert_transform(3)
48
49
50
51Allegro reference manual al_check_inverse(3)