29 static void init_stuff(
void);
43 #define ONORM .57445626 90 #define UP_NORM Octo[2] 91 #define DOWN_NORM Octo[5] 106 static void init_stuff(
void)
110 static int first = 1;
115 cos45 = cos(atan(1.0));
117 for (i = 0; i < 8; i++) {
139 Pi = 4.0 * atan(1.0);
159 v1[
Z] = v2[
Z] = center[
Z];
161 v1[
X] = v2[
X] = center[
X];
162 v1[
Y] = center[
Y] - siz;
163 v2[
Y] = center[
Y] + siz;
169 v1[
Y] = v2[
Y] = center[
Y];
170 v1[
X] = center[
X] - siz;
171 v2[
X] = center[
X] + siz;
200 for (i = 0; i < np; i++) {
212 v2[
Z] = pts[np - 1][
Z];
244 pdraw = n < np ? n : np;
248 for (i = 0; i < pdraw; i++) {
255 pt[
X] = pts[i - 1][
X];
256 pt[
Y] = pts[i - 1][
Y];
260 v2[
Z] = pts[np - 1][
Z];
285 v1[
Z] = v2[
Z] = center[
Z];
287 v1[
X] = center[
X] - siz;
288 v2[
X] = center[
X] + siz;
289 v1[
Y] = center[
Y] - siz;
290 v2[
Y] = center[
Y] + siz;
302 v1[
X] = center[
X] - siz;
303 v2[
X] = center[
X] + siz;
304 v1[
Y] = center[
Y] + siz;
305 v2[
Y] = center[
Y] - siz;
429 void gsd_cube(
float *center,
unsigned long colr,
float siz)
677 for (i = 0; i < 6; i++) {
758 float costheta, theta, adjacent;
766 if (dx == 0 && dy == 0) {
774 costheta = dx / sqrt(dx * dx + dy * dy);
775 theta = acos(costheta);
779 theta = (2 *
Pi) - theta;
790 else if (dx == 0 && dy == 0) {
794 adjacent = sqrt(dx * dx + dy * dy);
795 costheta = adjacent / sqrt(adjacent * adjacent + dz * dz);
796 theta = acos(costheta);
806 *aspect = *aspect * (180. /
Pi);
807 *slope = *slope * (180. /
Pi);
828 unsigned long arw_clr,
unsigned long text_clr)
833 float Ntop[] = { 0.0, 0.0, 1.0 };
835 base[0][
Z] = base[1][
Z] = base[2][
Z] = pos2[
Z];
836 v[0][
Z] = v[1][
Z] = v[2][
Z] = v[3][
Z] = pos2[
Z];
838 base[0][
X] = pos2[
X] - len / 16.;
839 base[1][
X] = pos2[
X] + len / 16.;
840 base[0][
Y] = base[1][
Y] = pos2[
Y] - len / 2.;
841 base[2][
X] = pos2[
X];
842 base[2][
Y] = pos2[
Y] + .45 * len;
844 v[0][
X] = v[2][
X] = pos2[
X];
845 v[1][
X] = pos2[
X] + len / 8.;
846 v[3][
X] = pos2[
X] - len / 8.;
847 v[0][
Y] = pos2[
Y] + .2 * len;
848 v[1][
Y] = v[3][
Y] = pos2[
Y] + .1 * len;
849 v[2][
Y] = pos2[
Y] + .5 * len;
861 glVertex3fv(base[0]);
862 glVertex3fv(base[1]);
863 glVertex3fv(base[2]);
892 glRasterPos3fv(base[0]);
893 glListBase(fontbase);
894 glCallLists(strlen(txt), GL_UNSIGNED_BYTE, (
const GLvoid *)txt);
923 int gsd_arrow(
float *center,
unsigned long colr,
float siz,
float *dir,
928 static int first = 1;
939 if (
NULL != onsurf) {
940 float base[3], tip[3], len;
947 tip[
X] = center[
X] + dir[
X] * len * siz;
948 tip[
Y] = center[
Y] + dir[
Y] * len * siz;
998 static int first = 1;
1008 G_debug(3,
"gsd_arrow_onsurf");
1009 G_debug(3,
" %f %f -> %f %f", base[
X], base[
Y], tip[X], tip[Y]);
1013 #ifdef DO_SPHERE_BASE 1017 gsd_disc(base[X], base[Y], len / 10.);
1023 base[
Z] = tip[
Z] = 0.0;
1026 G_debug(3,
" dir0: %f %f %f", dir0[X], dir0[Y], dir0[
Z]);
1034 G_debug(3,
" a-dir1: %f %f %f", dir1[X], dir1[Y], dir1[Z]);
1035 G_debug(3,
" a-dir2: %f %f %f", dir2[X], dir2[Y], dir2[Z]);
1042 G_debug(3,
" b-dir1: %f %f %f", dir1[X], dir1[Y], dir1[Z]);
1043 G_debug(3,
" b-dir2: %f %f %f", dir2[X], dir2[Y], dir2[Z]);
1049 G_debug(3,
" %f %f -> ", tmp[X], tmp[Y]);
1057 G_debug(3,
" dir1: %f %f %f", dir1[X], dir1[Y], dir1[Z]);
1058 G_debug(3,
" dir2: %f %f %f", dir2[X], dir2[Y], dir2[Z]);
1063 G_debug(3,
" %f %f", tmp[X], tmp[Y]);
1082 void gsd_3darrow(
float *center,
unsigned long colr,
float siz1,
float siz2,
1083 float *dir,
float sz)
1085 float slope, aspect;
1087 static int first = 1;
1089 static int debugint = 1;
1096 if (debugint > 100) {
1098 G_debug(3,
" pt: %f,%f,%f dir: %f,%f,%f slope: %f aspect: %f",
1099 center[
X], center[
Y], center[
Z], dir[X], dir[Y], dir[Z],
1162 unsigned long bar_clr,
unsigned long text_clr)
1166 float Ntop[] = { 0.0, 0.0, 1.0 };
1169 base[0][
Z] = base[1][
Z] = base[2][
Z] = base[3][
Z] = pos2[
Z];
1172 base[0][
X] = base[1][
X] = pos2[
X] - len / 2.;
1173 base[2][
X] = base[3][
X] = pos2[
X] + len / 2.;
1175 base[0][
Y] = base[3][
Y] = pos2[
Y] - len / 16.;
1176 base[1][
Y] = base[2][
Y] = pos2[
Y] + len / 16.;
1189 glVertex3fv(base[0]);
1190 glVertex3fv(base[1]);
1191 glVertex3fv(base[2]);
1192 glVertex3fv(base[3]);
1193 glVertex3fv(base[0]);
1205 sprintf(txt,
"%g km", len / 1000);
1207 sprintf(txt,
"%g meters", len);
1211 sprintf(txt,
"%g miles", len / 5280);
1212 else if (len == 5280)
1213 sprintf(txt,
"1 mile");
1215 sprintf(txt,
"%g feet", len);
1226 glRasterPos3fv(base[0]);
1227 glListBase(fontbase);
1228 glCallLists(strlen(txt), GL_BYTE, (GLubyte *) txt);
1250 unsigned long bar_clr,
unsigned long text_clr)
1253 float Ntop[] = { 0.0, 0.0, 1.0 };
1255 base[0][
Z] = base[1][
Z] = base[2][
Z] = pos[
Z];
1256 base[3][
Z] = base[4][
Z] = base[5][
Z] = pos[
Z];
1259 base[0][
X] = base[2][
X] = base[3][
X] = pos[
X] - len / 2.;
1260 base[1][
X] = base[4][
X] = base[5][
X] = pos[
X] + len / 2.;
1261 base[0][
Y] = base[1][
Y] = pos[
Y];
1262 base[2][
Y] = base[4][
Y] = pos[
Y] - len / 12;
1263 base[3][
Y] = base[5][
Y] = pos[
Y] + len / 12;
1315 static int first = 1;
1322 tip[
X] = tip[
Y] = 0.0;
1351 static int first = 1;
1422 { {1.0, 1.0, -1.0}, {-1.0, 1.0, -1.0}, {-1.0, 1.0, 1.0}, {1.0, 1.0, 1.0},
1423 {1.0, -1.0, -1.0}, {-1.0, -1.0, -1.0}, {-1.0, -1.0, 1.0}, {1.0, -1.0, 1.0}
1427 { {0, 0, -
ONORM}, {0, 0,
ONORM}, {0,
ONORM, 0}, {0, -
ONORM, 0}, {
ONORM, 0,
void gsd_3dcursor(float *pt)
Draw 3d cursor.
void gsd_litvert_func2(float *, unsigned long, float *)
ADD.
void gsd_endtfan(void)
ADD.
float Octo[6][3]
vertices for octahedron
void gsd_flush(void)
Mostly for flushing drawing commands across a network.
void gsd_diamond_lines(void)
Draw diamond lines.
float ogverts[8][3]
vertices & normals for octagon in xy plane
void gsd_bgnpolygon(void)
Delimit the vertices of a primitive or a group of like primitives.
float Box[8][3]
Vertices for box.
void gsd_popmatrix(void)
Pop the current matrix stack.
void gsd_endpolygon(void)
Delimit the vertices of a primitive or a group of like primitives.
void gsd_draw_box(float *center, unsigned long colr, float siz)
Draw box.
void GS_v3add(float *, float *)
Sum vectors.
int gsd_get_txtheight(int size)
Get text height.
void gsd_shademodel(int)
Set shaded model.
int gsd_north_arrow(float *pos2, float len, GLuint fontbase, unsigned long arw_clr, unsigned long text_clr)
Draw North Arrow takes OpenGL coords and size.
void gsd_calllist(int)
ADD.
void gsd_plus(float *center, int colr, float siz)
ADD.
int GS_v3norm(float *)
Change v1 so that it is a unit vector (2D)
void GS_v3cross(float *, float *, float *)
Get the cross product v3 = v1 cross v2.
void gsd_x(geosurf *gs, float *center, int colr, float siz)
Draw X symbol.
int gsd_arrow_onsurf(float *base, float *tip, unsigned long colr, int wid, geosurf *gs)
Draw north arrow on surface.
void gsd_rot(float, char)
ADD.
void gsd_cube(float *center, unsigned long colr, float siz)
Draw cube.
void gsd_diamond(float *center, unsigned long colr, float siz)
Draw diamond symbol.
void gsd_disc(float, float, float, float)
ADD.
float OctoN[8][3]
normals for flat-shaded octahedron
void gsd_backface(int)
ADD.
void gsd_color_func(unsigned int)
Set current color.
void gsd_swaptmesh(void)
ADD.
void dir_to_slope_aspect(float *dir, float *slope, float *aspect, int degrees)
ADD.
void gsd_endline(void)
End line.
void gsd_bgnqstrip(void)
ADD.
void gsd_translate(float, float, float)
Multiply the current matrix by a translation matrix.
void gsd_bgntfan(void)
ADD.
int gsd_scalebar(float *pos2, float len, GLuint fontbase, unsigned long bar_clr, unsigned long text_clr)
Draw Scalebar takes OpenGL coords and size.
int gsd_nline_onsurf(geosurf *gs, float *v1, float *v2, float *pt, int n)
Multiline on surface, fix z-values.
void primitive_cylinder(unsigned long col, int caps)
Primitives only called after transforms.
void GS_done_draw(void)
Draw done, swap buffers.
void gsd_sphere(float *, float)
ADD.
void gsd_draw_asterisk(float *center, unsigned long colr, float siz)
Draw asterisk.
float ogvertsplus[8][3]
vertices for octagon in xy plane, z=1
void gsd_line_onsurf(geosurf *gs, float *v1, float *v2)
Line on surface, fix z-values.
void gsd_bgnlist(int, int)
ADD.
void GS_v3eq(float *, float *)
Copy vector values.
void gsd_linewidth(short)
Set width of rasterized lines.
void gsd_circ(float, float, float)
ADD.
void gsd_litvert_func(float *, unsigned long, float *)
Set the current normal vector & specify vertex.
void GS_v3mag(float *, float *)
Magnitude of vector.
void gsd_endlist(void)
End list.
int GS_v3dir(float *, float *, float *)
Get a normalized direction from v1 to v2, store in v3.
void gsd_pushmatrix(void)
Push the current matrix stack.
void gsd_box(float *center, int colr, float *siz)
Draw box.
Point3 * gsdrape_get_segments(geosurf *, float *, float *, int *)
ADD.
int gsd_makelist(void)
ADD.
void gsd_bgntmesh(void)
ADD.
int gsd_scalebar_v2(float *pos, float len, GLuint fontbase, unsigned long bar_clr, unsigned long text_clr)
Draw Scalebar (as lines)
void gsd_draw_gyro(float *center, unsigned long colr, float siz)
Draw gyro.
void gsd_endtmesh(void)
ADD.
float GS_P2distance(float *, float *)
Calculate distance in plane.
int gsd_getshademodel(void)
Get shaded model.
int gsd_get_txtwidth(const char *, int)
Get text width.
void primitive_cone(unsigned long col)
Primitives only called after transforms.
void GS_set_draw(int)
Sets which buffer to draw to.
const char * G_database_unit_name(int)
Get units (localized) name for the current location.
void gsd_do_scale(int)
Set current scale.
void gsd_3darrow(float *center, unsigned long colr, float siz1, float siz2, float *dir, float sz)
Draw 3d north arrow.
int G_debug(int, const char *,...) __attribute__((format(printf
void gsd_scale(float, float, float)
Multiply the current matrix by a general scaling matrix.
void gsd_drawsphere(float *center, unsigned long colr, float siz)
Draw sphere.
int gsd_arrow(float *center, unsigned long colr, float siz, float *dir, float sz, geosurf *onsurf)
ADD.
void gsd_bgnline(void)
Begin line.
void GS_v3mult(float *, float)
Multiple vectors.
void gsd_endqstrip(void)
ADD.
void gsd_vert_func(float *)
ADD.