15 #include <grass/nviz.h>
17 static void cp_draw(nv_data *,
int,
int,
int);
31 data->cp_rot[
id][
X] = data->cp_rot[
id][
Y] = data->cp_rot[
id][Z] = 0.0;
32 data->cp_trans[
id][
X] = data->cp_trans[
id][
Y] = data->cp_trans[
id][Z] =
47 data->cur_cplane =
id;
76 cp_draw(data, data->cur_cplane, bound1, bound2);
89 void cp_draw(nv_data *
data,
int current,
int surf1,
int surf2)
92 int surf_min = 0, surf_max = 0, temp;
101 if ((surf1 != -1) && (surf2 != -1)) {
102 for (i = 0; i < nsurfs; i++) {
103 if (surf_list[i] == surf1)
105 if (surf_list[i] == surf2)
109 if (surf_max < surf_min) {
123 for (i = 0; i < MAX_CPLANES; i++) {
129 for (i = surf_min; i < surf_max; i++) {
144 return data->num_cplanes;
154 return data->cur_cplane;
169 data->cp_rot[
id][
X] = dx;
170 data->cp_rot[
id][
Y] = dy;
171 data->cp_rot[
id][Z] = dz;
173 data->cp_rot[
id][Z]);
175 cp_draw(data, data->cur_cplane, -1, -1);
191 *dx = data->cp_rot[
id][
X];
192 *dy = data->cp_rot[
id][
Y];
193 *dz = data->cp_rot[
id][Z];
209 data->cp_trans[
id][
X] = dx;
210 data->cp_trans[
id][
Y] = dy;
211 data->cp_trans[
id][Z] = dz;
213 data->cp_trans[
id][Z]);
215 cp_draw(data, data->cur_cplane, -1, -1);
228 *dx = data->cp_trans[
id][
X];
229 *dy = data->cp_trans[
id][
Y];
230 *dz = data->cp_trans[
id][Z];
248 float x,
y, z, len, los[2][3];
258 realto[
X] = x - gs->ox + gs->x_trans;
259 realto[
Y] = y - gs->oy + gs->y_trans;
260 realto[Z] = z + gs->z_trans;
270 realto[
X] = Gv.from_to[
FROM][
X] + dir[
X];
271 realto[
Y] = Gv.from_to[
FROM][
Y] + dir[
Y];
272 realto[Z] = Gv.from_to[
FROM][Z] + dir[Z];
280 dx = realto[
X] - (e -
w) / 2.;
281 dy = realto[
Y] - (n -
s) / 2.;
int GS_get_selected_point_on_surface(int sx, int sy, int *id, float *x, float *y, float *z)
Get selected point of surface.
int Nviz_draw_cplane(nv_data *data, int bound1, int bound2)
Draw the clip plane.
void GS_done_draw(void)
Draw done, swap buffers.
int Nviz_set_fence_color(nv_data *data, int type)
Set appropriate fence color.
int GS_v3dir(float *v1, float *v2, float *v3)
Get a normalized direction from v1 to v2, store in v3.
int Nviz_set_cplane_rotation(nv_data *data, int id, float dx, float dy, float dz)
Set the rotation for the current clip plane.
int GS_get_region(float *n, float *s, float *w, float *e)
Get 2D region extent.
void GS_clear(int col)
Clear view.
int Nviz_get_cplane_rotation(nv_data *data, int id, float *dx, float *dy, float *dz)
Get the rotation values for the current clip plane.
int GS_draw_cplane_fence(int hs1, int hs2, int num)
Draw cplace fence ?
void GS_set_cplane_trans(int num, float dx, float dy, float dz)
Set cplace trans.
void GS_set_cplane_rot(int num, float dx, float dy, float dz)
Set cplace rotation.
void GS_set_fencecolor(int mode)
Set fence color.
void GS_v3mult(float *v1, float k)
Multiple vectors.
int Nviz_off_cplane(nv_data *data, int id)
Turn off (make inactive) the given clip plane.
void GS_unset_cplane(int num)
Unset clip place (turn off)
int Nviz_set_cplane_translation(nv_data *data, int id, float dx, float dy, float dz)
Set the translation for the current clip plane.
int Nviz_get_current_cplane(nv_data *data)
Get the current active cutplane.
void GS_set_cplane(int num)
Set cplace.
int Nviz_on_cplane(nv_data *data, int id)
Turn on (make current) the given clip plane.
int Nviz_num_cplanes(nv_data *data)
Return the number of clip planes objects currently allocated.
geosurf * gs_get_surf(int id)
Get geosurf struct.
int Nviz_set_cplane_here(nv_data *data, int cplane, float sx, float sy)
int Nviz_new_cplane(nv_data *data, int id)
Creates a clip plane object.
int * GS_get_surf_list(int *numsurfs)
Get surface list.
float GS_distance(float *from, float *to)
Calculate distance.
int Nviz_get_cplane_translation(nv_data *data, int id, float *dx, float *dy, float *dz)
Get the translation values for the current clip plane.
void GS_draw_wire(int id)
Draw surface wire.
int gsd_get_los(float(*vect)[3], short sx, short sy)
ADD.
void GS_set_draw(int where)
Sets which buffer to draw to.