File: al_transform_coordinates_3d_projective.3

package info (click to toggle)
allegro5 2%3A5.2.6.0-3%2Bdeb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 24,212 kB
  • sloc: ansic: 125,319; cpp: 15,781; objc: 4,579; python: 2,802; java: 2,254; javascript: 1,204; sh: 1,002; makefile: 51; perl: 37; xml: 25; pascal: 24
file content (68 lines) | stat: -rw-r--r-- 1,898 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
.\" Automatically generated by Pandoc 1.19.2.4
.\"
.TH "al_transform_coordinates_3d_projective" "3" "" "Allegro reference manual" ""
.hy
.SH NAME
.PP
al_transform_coordinates_3d_projective \- Allegro 5 API
.SH SYNOPSIS
.IP
.nf
\f[C]
#include\ <allegro5/allegro.h>

void\ al_transform_coordinates_3d_projective(const\ ALLEGRO_TRANSFORM\ *trans,
\ \ \ float\ *x,\ float\ *y,\ float\ *z)
\f[]
.fi
.SH DESCRIPTION
.PP
Transform x, y, z as homogeneous coordinates.
This is the same as using al_transform_coordinates_4d(3) with the w
coordinate set to 1, then dividing x, y, z by the resulting w.
This will provide the same normalized coordinates Allegro will draw to
when a projective transform is in effect as set with
al_use_projection_transform(3).
To get the actual pixel coordinates from those translate and scale like
so (w and h would be the pixel dimensions of the target bitmap):
.IP
.nf
\f[C]
x\ =\ w\ /\ 2\ +\ x\ *\ w\ /\ 2
y\ =\ h\ /\ 2\ \-\ y\ *\ h\ /\ 2
\f[]
.fi
.PP
\f[I]Parameters:\f[]
.IP \[bu] 2
trans \- Transformation to use
.IP \[bu] 2
x, y, z \- Pointers to the coordinates
.PP
Example:
.IP
.nf
\f[C]
ALLEGRO_TRANSFORM\ t2;
al_copy_transform(&t2,\ al_get_current_transform());
al_compose_transform(&t2,\ al_get_current_projection_transform());

ALLEGRO_TRANSFORM\ t3;
al_identity_transform(&t3);
al_scale_transform(&t3,\ 0.5,\ \-0.5);
al_translate_transform(&t3,\ 0.5,\ 0.5);
al_scale_transform(&t3,\ al_get_bitmap_width(al_get_target_bitmap()),
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ al_get_bitmap_height(al_get_target_bitmap()));

al_transform_coordinates_3d_projective(&t2,\ &x,\ &y,\ &z);
//\ x,\ y\ now\ contain\ normalized\ coordinates
al_transform_coordinates(&t3,\ &x,\ &y);
//\ x,\ y\ now\ contain\ pixel\ coordinates
\f[]
.fi
.PP
Since 5.2.4
.SH SEE ALSO
.PP
al_use_transform(3), al_transform_coordinates(3),
al_transform_coordinates_3d(3), al_use_projection_transform(3)