summaryrefslogtreecommitdiff
path: root/src/OpenGl/OpenGl_togl_unproject_raster.cxx
blob: 72bdad9ae35194bb0321653defee8680f4dd882d (plain)
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/***********************************************************************

FONCTION :
----------
File OpenGl_togl_unproject_raster :


REMARQUES:
---------- 


HISTORIQUE DES MODIFICATIONS   :
--------------------------------
24-05-96 : CAL ; Creation

************************************************************************/

/*----------------------------------------------------------------------*/
/*
* Includes
*/
#include <OpenGl_tgl_all.hxx>
#include <OpenGl_telem_util.hxx>

int EXPORT
call_togl_unproject_raster
(
 int wsid,
 int xm,
 int ym,
 int xM,
 int yM,
 int ixr,
 int iyr,
 float *x,
 float *y,
 float *z
 )
{
  TStatus result;
  Tint xr, yr;

  xr = ixr;
  /* 
  Patched by P.Dolbey: the window pixel height decreased by one 
  in order for yr to remain within valid coordinate range [0; Ym -1]
  where Ym means window pixel height.
  */
  yr = (yM-1)-ym-iyr;
  result = TelUnProjectionRaster (wsid, xr, yr, x, y, z);

  if (result == TSuccess)
    return (0);
  else
    return (1);
}

int EXPORT
call_togl_unproject_raster_with_ray
(
 int wsid,
 int xm,
 int ym,
 int xM,
 int yM,
 int ixr,
 int iyr,
 float *x,
 float *y,
 float *z,
 float *dx,
 float *dy,
 float *dz
 )
{
  TStatus result;
  Tint xr, yr;

  xr = ixr;
  yr = yM-ym-iyr;
  result = TelUnProjectionRasterWithRay (wsid, xr, yr, x, y, z, dx, dy, dz);

  if (result == TSuccess)
    return (0);
  else
    return (1);
}