# OpenGl_telem_util.h File Reference

`#include <math.h>`
`#include <GL/gl.h>`
`#include <GL/glx.h>`
`#include <OpenGl_telem.h>`

## Defines

#define | IMP190100
#define | BUC60823
#define | shortreallast() (3.e+38)
#define | shortrealfirst() (-3.e+38)
#define | square(a) ((a)*(a))
#define | vecadd(a, b, c)
#define | vecsub(a, b, c)
#define | vecdot(a, b) ((a)[0]*(b)[0]+(a)[1]*(b)[1]+(a)[2]*(b)[2])
#define | veccrs(a, b, c)
#define | vecscl(a, b) { (b)[0] *= (a); (b)[1] *= (a); (b)[2] *= (a); }
#define | vecmg2(a) (square((a)[0])+square((a)[1])+square((a)[2]))
#define | vecmag(a) (sqrt((double)vecmg2(a)))
#define | vecnrmd(a, d)
#define | vecnrm(a) { Tfloat d; vecnrmd(a,d); }
#define | vecang(a, b, d)
#define | vecgnd(a, b, c, d)
#define | veccpy(a, b) ((a)[0]=(b)[0],(a)[1]=(b)[1],(a)[2]=(b)[2])
#define | matcpy(d, s) { *((Tmatrix3Struct*)(d)) = *((Tmatrix3Struct*)(s)); }
#define | matdump(m)

## Functions

Tint | TelRemdupnames (Tint *, Tint)
int | TelGetPolygonNormal (tel_point, Tint *, Tint, Tfloat *)
int | TelGetNormal (Tfloat *, Tfloat *, Tfloat *, Tfloat *)
Tint | TelIsBackFace (Tmatrix3, Tfloat *)
Tint | TelIsBackFacePerspective (Tmatrix3, Tfloat *, Tfloat *, Tfloat *)
void | TelMultiplymat3 (Tmatrix3, Tmatrix3, Tmatrix3)
void | TelTransposemat3 (Tmatrix3)
void | TelTranpt3 (Tfloat[4], Tfloat[4], Tmatrix3)
void | TelInitWS (Tint, Tint, Tint, Tfloat, Tfloat, Tfloat)
void | TelSwapBuffers (Tint)
void | TelCopyBuffers (Tint, GLenum, GLenum, Tfloat, Tfloat, Tfloat, Tfloat, Tfloat, Tfloat, Tint)
TStatus | TelProjectionRaster (Tint ws, Tfloat x, Tfloat y, Tfloat z, Tfloat *xr, Tfloat *yr)
TStatus | TelUnProjectionRaster (Tint ws, Tint xr, Tint yr, Tfloat *x, Tfloat *y, Tfloat *z)
Tint | TelBackBufferRestored (void)
void | TelSetBackBufferRestored (Tint)
void | TelEnable (Tint)
void | TelDisable (Tint)
void | TelFlush (Tint)
void | TelSetFrontFaceAttri (Tint, Tint, Tint, Tint, Tint, Tint, Tint, Tint, tel_surf_prop, tel_surf_prop, tel_colour, tel_colour)
void | TelSetBackFaceAttri (Tint, Tint, Tint, Tint, Tint, Tint, Tint, Tint, tel_surf_prop, tel_surf_prop, tel_colour, tel_colour)
void | TelReadImage (Tint, GLenum, Tint, Tint, Tint, Tint, unsigned int *)
void | TelDrawImage (Tint, GLenum, Tint, Tint, Tint, Tint, unsigned int *)
void | TelReadDepths (Tint, Tint, Tint, Tint, Tint, float *)
void | TelMakeFrontBufCurrent (Tint)
void | TelMakeBackBufCurrent (Tint)
void | TelMakeFrontAndBackBufCurrent (Tint)
void | TelSetPixmapDBParams (Display *dpy, Window window, int width, int height, int depth, GC gc, Pixmap pixmap, GLXPixmap glxpixmap, GLXContext ctx)
GLXPixmap | TelGetGLXPixmap (void)
void | TelSetPixmapDB (int flag)
int | TelTestPixmapDB (void)
void | TelDrawBuffer (GLenum buf)

## Define Documentation

#define BUC60823

#define IMP190100

#define matcpy | ( | d,
|  | s |  | ) | { *((Tmatrix3Struct*)(d)) = *((Tmatrix3Struct*)(s)); }

#define matdump | ( | m |  | ) |

Value:

    { \
    int i, j; \
      for (i=0; i<4; i++) {\
        printf ("\t"); \
        for (j=0; j<4; j++) \
          printf ("%f ", m[i][j]); \
        printf ("\n"); \
      } \
    }

#define shortrealfirst | (

)

(-3.e+38)

#define shortreallast | (

)

(3.e+38)

#define square | ( | a |  | ) | ((a)*(a))

#define vecadd | ( | a,
|  | b,
|  | c |  | ) |

Value:

    { (a)[0]=(b)[0]+(c)[0]; \
                              (a)[1]=(b)[1]+(c)[1]; \
                              (a)[2]=(b)[2]+(c)[2]; }

#define vecang | ( | a,
|  | b,
|  | d |  | ) |

Value:

    { d = (Tfloat)(vecmag(a)*vecmag(b)); \
                               d = vecdot(a,b)/d; \
                               d = d < -1.0F ? -1.0F : d > 1.0F ? 1.0F : d; \
                               d = ( Tfloat )acos(d); }

#define veccpy | ( | a,
|  | b |  | ) | ((a)[0]=(b)[0],(a)[1]=(b)[1],(a)[2]=(b)[2])

#define veccrs | ( | a,
|  | b,
|  | c |  | ) |

Value:

    { Tfloat x, y, z; \
                              x = (b)[1]*(c)[2] - (b)[2]*(c)[1]; \
                              y = (b)[2]*(c)[0] - (b)[0]*(c)[2]; \
                              z = (b)[0]*(c)[1] - (b)[1]*(c)[0]; \
                              (a)[0] = x; \
                              (a)[1] = y; \
                              (a)[2] = z; }

#define vecdot | ( | a,
|  | b |  | ) | ((a)[0]*(b)[0]+(a)[1]*(b)[1]+(a)[2]*(b)[2])

#define vecgnd | ( | a,
|  | b,
|  | c,
|  | d |  | ) |

Value:

    { Tfloat w; w = d/vecmag(c); \
                               (a)[0] = (b)[0]+(c)[0]*w;  \
                               (a)[1] = (b)[1]+(c)[1]*w;  \
                               (a)[2] = (b)[2]+(c)[2]*w;  }

#define vecmag | ( | a |  | ) | (sqrt((double)vecmg2(a)))

#define vecmg2 | ( | a |  | ) | (square((a)[0])+square((a)[1])+square((a)[2]))

#define vecnrm | ( | a |  | ) | { Tfloat d; vecnrmd(a,d); }

#define vecnrmd | ( | a,
|  | d |  | ) |

Value:

    ( d = (Tfloat)vecmag(a), \
             ( d > 1e-10 ? (a[0] /= d, a[1] /= d, a[2] /= d, d) : (Tfloat)0. ) )

#define vecscl | ( | a,
|  | b |  | ) | { (b)[0] *= (a); (b)[1] *= (a); (b)[2] *= (a); }

#define vecsub | ( | a,
|  | b,
|  | c |  | ) |

Value:

    { (a)[0]=(b)[0]-(c)[0]; \
                              (a)[1]=(b)[1]-(c)[1]; \
                              (a)[2]=(b)[2]-(c)[2]; }

## Function Documentation

Tint TelBackBufferRestored | ( | void |  | ) |

void TelCopyBuffers | ( | Tint | ,
|  | GLenum | ,
|  | GLenum | ,
|  | Tfloat | ,
|  | Tfloat | ,
|  | Tfloat | ,
|  | Tfloat | ,
|  | Tfloat | ,
|  | Tfloat | ,
|  | Tint |
| ) |

void TelDisable | ( | Tint |  | ) |

void TelDrawBuffer | ( | GLenum | buf | ) |

void TelDrawImage | ( | Tint | ,
|  | GLenum | ,
|  | Tint | ,
|  | Tint | ,
|  | Tint | ,
|  | Tint | ,
|  | unsigned int * |
| ) |

void TelEnable | ( | Tint |  | ) |

void TelFlush | ( | Tint |  | ) |

GLXPixmap TelGetGLXPixmap | ( | void |  | ) |

int TelGetNormal | ( | Tfloat * | ,
|  | Tfloat * | ,
|  | Tfloat * | ,
|  | Tfloat * |
| ) |

int TelGetPolygonNormal | ( | tel_point | ,
|  | Tint * | ,
|  | Tint | ,
|  | Tfloat * |
| ) |

void TelInitWS | ( | Tint | ,
|  | Tint | ,
|  | Tint | ,
|  | Tfloat | ,
|  | Tfloat | ,
|  | Tfloat |
| ) |

Tint TelIsBackFace | ( | Tmatrix3 | ,
|  | Tfloat * |
| ) |

Tint TelIsBackFacePerspective | ( | Tmatrix3 | ,
|  | Tfloat * | ,
|  | Tfloat * | ,
|  | Tfloat * |
| ) |

void TelMakeBackBufCurrent | ( | Tint |  | ) |

void TelMakeFrontAndBackBufCurrent | ( | Tint |  | ) |

void TelMakeFrontBufCurrent | ( | Tint |  | ) |

void TelMultiplymat3 | ( | Tmatrix3 | ,
|  | Tmatrix3 | ,
|  | Tmatrix3 |
| ) |

TStatus TelProjectionRaster | ( | Tint | ws,
|  | Tfloat | x,
|  | Tfloat | y,
|  | Tfloat | z,
|  | Tfloat * | xr,
|  | Tfloat * | yr
| ) |

void TelReadDepths | ( | Tint | ,
|  | Tint | ,
|  | Tint | ,
|  | Tint | ,
|  | Tint | ,
|  | float * |
| ) |

void TelReadImage | ( | Tint | ,
|  | GLenum | ,
|  | Tint | ,
|  | Tint | ,
|  | Tint | ,
|  | Tint | ,
|  | unsigned int * |
| ) |

Tint TelRemdupnames | ( | Tint * | ,
|  | Tint |
| ) |

void TelSetBackBufferRestored | ( | Tint |  | ) |

void TelSetBackFaceAttri | ( | Tint | ,
|  | Tint | ,
|  | Tint | ,
|  | Tint | ,
|  | Tint | ,
|  | Tint | ,
|  | Tint | ,
|  | Tint | ,
|  | tel_surf_prop | ,
|  | tel_surf_prop | ,
|  | tel_colour | ,
|  | tel_colour |
| ) |

void TelSetFrontFaceAttri | ( | Tint | ,
|  | Tint | ,
|  | Tint | ,
|  | Tint | ,
|  | Tint | ,
|  | Tint | ,
|  | Tint | ,
|  | Tint | ,
|  | tel_surf_prop | ,
|  | tel_surf_prop | ,
|  | tel_colour | ,
|  | tel_colour |
| ) |

void TelSetPixmapDB | ( | int | flag | ) |

void TelSetPixmapDBParams | ( | Display * | dpy,
|  | Window | window,
|  | int | width,
|  | int | height,
|  | int | depth,
|  | GC | gc,
|  | Pixmap | pixmap,
|  | GLXPixmap | glxpixmap,
|  | GLXContext | ctx
| ) |

void TelSwapBuffers | ( | Tint |  | ) |

int TelTestPixmapDB | ( | void |  | ) |

void TelTranpt3 | ( | Tfloat | [4],
|  | Tfloat | [4],
|  | Tmatrix3 |
| ) |

void TelTransposemat3 | ( | Tmatrix3 |  | ) |

TStatus TelUnProjectionRaster | ( | Tint | ws,
|  | Tint | xr,
|  | Tint | yr,
|  | Tfloat * | x,
|  | Tfloat * | y,
|  | Tfloat * | z
| ) |