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

Nviz library – Change view settings. More...

`#include <math.h>`
`#include <grass/glocale.h>`
`#include <grass/nviz.h>`
Include dependency graph for change_view.c:

Go to the source code of this file.

## Functions

int | Nviz_resize_window (int width, int height)
| GL canvas resized.
int | Nviz_update_ranges (nv_data *dc)
| Update ranges.
int | Nviz_set_viewpoint_position (double x_pos, double y_pos)
| Change position of view.
void | Nviz_get_viewpoint_position (double *x_pos, double *y_pos)
int | Nviz_set_viewpoint_height (double height)
| Change viewpoint height.
void | Nviz_get_viewpoint_height (double *height)
int | Nviz_set_viewpoint_persp (int persp)
| Change viewpoint perspective (field of view).
int | Nviz_set_viewpoint_twist (int twist)
| Change viewpoint twist.
int | Nviz_change_exag (nv_data *data, double exag)
| Change z-exag value.
int | Nviz_look_here (double sx, double sy)
| Change focused point.
void | Nviz_get_modelview (double *modelMatrix)
| Get current modelview matrix.
void | Nviz_set_rotation (double angle, double x, double y, double z)
| Set rotation parameters.
void | Nviz_unset_rotation (void)
| Stop scene rotation.
void | Nviz_init_rotation (void)
| Stop scene rotation.
void | Nviz_flythrough (nv_data *data, float *fly_info, int *scale, int lateral)
| Fly through the scene.

## Detailed Description

Nviz library – Change view settings.

Based on visualization/nviz/src/change_view.c

(C) 2008, 2010 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
  Updated/modified by Martin Landa <landa.martin gmail.com> (Google SoC 2008/2010)

Definition in file change_view.c.

## Function Documentation

## Nviz_change_exag()

int Nviz_change_exag | ( | nv_data * | data,
|  | double | exag )

Change z-exag value.

Parameters

  data | nviz data
  exag | exag value

Returns
  1

Definition at line 238 of file change_view.c.

References G_debug(), GS_global_exag(), GS_set_global_exag(), and Nviz_update_ranges().

## Nviz_flythrough()

void Nviz_flythrough | ( | nv_data * | data,
|  | float * | fly_info,
|  | int * | scale,
|  | int | lateral )

Fly through the scene.

Computes parameters needed for moving scene. Changes viewpoint and viewdir. Based on visualization/nviz/src/togl_flythrough.c and simplified.

Parameters

  data | nviz data [unused]
  fly_info | values computed from mouse movement
  scale | rate of movement
  lateral | type of movement

Definition at line 324 of file change_view.c.

References GS_get_from(), GS_get_viewdir(), GS_moveto(), GS_set_viewdir(), X, and Y.

## Nviz_get_modelview()

void Nviz_get_modelview | ( | double * | modelMatrix | ) |

Get current modelview matrix.

Definition at line 272 of file change_view.c.

## Nviz_get_viewpoint_height()

void Nviz_get_viewpoint_height | ( | double * | height | ) |

Definition at line 181 of file change_view.c.

References G_debug(), and GS_get_from_real().

## Nviz_get_viewpoint_position()

void Nviz_get_viewpoint_position | ( | double * | x_pos,
|  | double * | y_pos )

Definition at line 131 of file change_view.c.

References G_debug(), GS_get_from(), X, and Y.

## Nviz_init_rotation()

void Nviz_init_rotation | ( | void |  | ) |

Stop scene rotation.

Definition at line 306 of file change_view.c.

References GS_init_rotation().

## Nviz_look_here()

int Nviz_look_here | ( | double | sx,
|  | double | sy )

Change focused point.

Parameters

  sx,sy | screen coordinates

Returns
  1

Definition at line 262 of file change_view.c.

References G_debug(), and GS_look_here().

## Nviz_resize_window()

int Nviz_resize_window | ( | int | width,
|  | int | height )

GL canvas resized.

Parameters

  width | window width
  height | window height

Returns
  1 on success
  0 on failure (window resized by default to 20x20 px)

Definition at line 30 of file change_view.c.

References G_debug(), GS_alldraw_wire(), GS_done_draw(), GS_ready_draw(), GS_set_draw(), and GS_set_viewport().

## Nviz_set_rotation()

void Nviz_set_rotation | ( | double | angle,
|  | double | x,
|  | double | y,
|  | double | z )

Set rotation parameters.

Rotate scene by given parameters related to mouse drag event (difference from current state). Coordinates determine the second point of rotation axis, the first point is (0, 0, 0).

Parameters

  angle | angle
  x,y,z | axis coordinate

Definition at line 288 of file change_view.c.

References G_debug(), GS_set_rotation(), and x.

## Nviz_set_viewpoint_height()

int Nviz_set_viewpoint_height | ( | double | height | ) |

Change viewpoint height.

Parameters

  height | height value (world coordinates)

Returns
  1

Definition at line 157 of file change_view.c.

References G_debug(), GS_get_from_real(), and GS_moveto_real().

## Nviz_set_viewpoint_persp()

int Nviz_set_viewpoint_persp | ( | int | persp | ) |

Change viewpoint perspective (field of view).

Parameters

  persp | perspective value (0-100, in degrees)

Returns
  1

Definition at line 199 of file change_view.c.

References G_debug(), and GS_set_fov().

## Nviz_set_viewpoint_position()

int Nviz_set_viewpoint_position | ( | double | x_pos,
|  | double | y_pos )

Change position of view.

Parameters

  x_pos | x position (model coordinates)
  y_pos | y position (model coordinates)

Returns
  1

Definition at line 97 of file change_view.c.

References G_debug(), GS_get_from(), GS_moveto(), X, and Y.

## Nviz_set_viewpoint_twist()

int Nviz_set_viewpoint_twist | ( | int | twist | ) |

Change viewpoint twist.

Parameters

  twist | persp twist value (-180-180, in degrees)

Returns
  1

Definition at line 220 of file change_view.c.

References G_debug(), and GS_set_twist().

## Nviz_unset_rotation()

void Nviz_unset_rotation | ( | void |  | ) |

Stop scene rotation.

Definition at line 298 of file change_view.c.

References GS_unset_rotation().

## Nviz_update_ranges()

int Nviz_update_ranges | ( | nv_data * | dc | ) |

Update ranges.

Call whenever a new surface is added, deleted, or exag changes

Returns
  1

Definition at line 61 of file change_view.c.

References GS_get_longdim(), GS_get_zrange_nz(), and GS_global_exag().

Referenced by Nviz_change_exag(), and Nviz_set_attr().