Loading...
Searching...
No Matches
trans.c File Reference

OGSF library - matrix transformation (higher level functions). More...

`#include <math.h>`
`#include <grass/gis.h>`
`#include <grass/glocale.h>`
`#include <grass/ogsf.h>`
Include dependency graph for trans.c:

Go to the source code of this file.

## Macros

#define | MAX_STACK 20
#define | NPI M_PI

## Functions

void | P_scale (float x, float y, float z)
| ADD.
void | P_transform (int num_vert, float(*in)[4], float(*out)[4])
| Transform array of vectors using current T matrix.
int | P_pushmatrix (void)
| Push current transformation matrix onto matrix stack.
int | P_popmatrix (void)
| Pop top of matrix stack, placing it into the current transformation matrix.
void | P_rot (float angle, char axis)
| Rotate matrix.

## Detailed Description

OGSF library - matrix transformation (higher level functions).

GRASS OpenGL gsurf OGSF Library

NOTE: This file should be REMOVED and any calls to the functions in this file should be replaced with appropriate OpenGL calls.

This routine should be available in GL!

Arguments are same as GL counterparts

I threw this code together in January at the beginning of this class. I was still learning about GL at the time. There are many places where the code could be improved.

(C) 1999-2008 by the GRASS Development Team

This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.

Author
  Dave Gerdes Jan 1990 All rights reserved, US Army Construction Engineering Research Lab
  Bill Brown USACERL (November 1993)
  Doxygenized by Martin Landa <landa.martin gmail.com> (May 2008)

Definition in file trans.c.

## Macro Definition Documentation

## MAX_STACK

#define MAX_STACK 20

Definition at line 37 of file trans.c.

Referenced by P_pushmatrix().

## NPI

#define NPI M_PI

Definition at line 49 of file trans.c.

Referenced by P_rot().

## Function Documentation

## P_popmatrix()

int P_popmatrix | ( | void |  | ) |

Pop top of matrix stack, placing it into the current transformation matrix.

Returns
  -1 on failure
  0 on success

Definition at line 188 of file trans.c.

References G_warning().

Referenced by gsd_update_cpnorm(), P_rot(), and P_scale().

## P_pushmatrix()

int P_pushmatrix | ( | void |  | ) |

Push current transformation matrix onto matrix stack.

Definition at line 167 of file trans.c.

References G_warning(), and MAX_STACK.

Referenced by gsd_update_cpnorm(), P_rot(), and P_scale().

## P_rot()

void P_rot | ( | float | angle,
|  | char | axis )

Rotate matrix.

Parameters

  angle | angle value
  axis | ('x, 'y', 'z')

Definition at line 208 of file trans.c.

References NPI, P_popmatrix(), and P_pushmatrix().

Referenced by gsd_update_cpnorm().

## P_scale()

void P_scale | ( | float | x,
|  | float | y,
|  | float | z )

ADD.

Parameters

  x,y,z |

Definition at line 65 of file trans.c.

References P_popmatrix(), P_pushmatrix(), and x.

## P_transform()

void P_transform | ( | int | num_vert,
|  | float(*) | in[4],
|  | float(*) | out[4] )

Transform array of vectors using current T matrix.

Multiply 'in' matrix (homogeneous coordinate generally) by the current transformation matrix, placing the result in 'out'

[in][trans_mat] => [out]

Parameters

  num_vert |
  in |
  out |

Definition at line 107 of file trans.c.

Referenced by gsd_update_cpnorm().