38#define DEBUG_ARROW (0)
43#define SET_SCOLOR(sf) \
44 if (check_color[sf]) { \
45 tx = points[sf][i][X] - gsurfs[sf]->x_trans; \
46 ty = points[sf][i][Y] - gsurfs[sf]->y_trans; \
47 offset = XY2OFF(gsurfs[sf], tx, ty); \
48 colors[sf] = gs_mapcolor(cobuf[sf], coloratt[sf], offset); \
52static int get_point_below(
Point3 **,
geosurf **,
int,
int,
int,
int *);
142 float x1, x2, y1, y2,
tx,
ty, tz,
ttr;
143 float n[3],
pt[4], xres, yres, ymax,
zexag;
163 G_debug(3,
"gsd_surf_map_old");
191 ymax = (
surf->rows - 1) *
surf->yres;
199 window[0] += (
int)(yres * 2);
200 window[1] -= (
int)(yres * 2);
201 window[2] -= (
int)(xres * 2);
202 window[3] += (
int)(xres * 2);
294 for (row = 0; row <
ycnt; row++) {
306 y1 = ymax - row * yres;
307 y2 = ymax - (row + 1) * yres;
405 x2 = (
col + 1) * xres;
731 float x1, x2, y1, y2,
tx,
ty, tz;
732 float n[3],
pt[4], xres, yres, ymax,
zexag;
744 unsigned int ktrans = 255;
746 G_debug(5,
"gsd_surf_const(): id=%d",
surf->gsurf_id);
769 ymax = (
surf->rows - 1) *
surf->yres;
774 window[0] += (
int)(yres * 2);
775 window[1] -= (
int)(yres * 2);
776 window[2] -= (
int)(xres * 2);
777 window[3] += (
int)(xres * 2);
854 for (row = 0; row <
ycnt; row++) {
866 y1 = ymax - row * yres;
867 y2 = ymax - (row + 1) * yres;
925 x2 = (
col + 1) * xres;
1268 if (
gsurfs[n]->curmask) {
1269 if (transpoint_is_masked(
gsurfs[n], points[n][
ptn])) {
1330 for (n = 0; n < ns; ++n) {
1340 colors[n] =
gsurfs[n]->wire_color;
1383 for (n = 0; n < ns; ++n) {
1384 for (i = 0; i < np; i++) {
1407 if (!transpoint_is_masked(
gsurfs[n],
1408 points[n][i - 1]) &&
1410 points[
bn][i - 1])) {
1412 1.0, points[n][i][
Z], 0.0,
1413 points[
bn][i - 1][
Z], 1.0,
1414 points[
bn][i][
Z], &
tx,
1417 xing[
Y] = points[n][i - 1][
Y] +
1418 tx * (points[n][i][
Y] -
1419 points[n][i - 1][
Y]);
1420 xing[
X] = points[n][i - 1][
X] +
1421 tx * (points[n][i][
X] -
1422 points[n][i - 1][
X]);
1425 tx * (points[
bn][i][
Z] -
1426 points[
bn][i - 1][
Z]);
1438 while (i < np && 0 < (
bsret = get_point_below(
1496 if (!transpoint_is_masked(
gsurfs[n],
1497 points[n][i - 1]) &&
1499 points[
bnl][i - 1]) &&
1501 points[
bn][i - 1])) {
1504 0.0, points[n][i - 1][
Z], 1.0,
1505 points[n][i][
Z], 0.0,
1506 points[
bn][i - 1][
Z], 1.0,
1507 points[
bn][i][
Z], &
tx, &
ty)) {
1512 "crossing going up at surf %d no. %d",
1517 xing[
Y] = points[n][i - 1][
Y] +
1518 tx * (points[n][i][
Y] -
1519 points[n][i - 1][
Y]);
1520 xing[
X] = points[n][i - 1][
X] +
1521 tx * (points[n][i][
X] -
1522 points[n][i - 1][
X]);
1526 tx * (points[
bnl][i][
Z] -
1527 points[
bnl][i - 1][
Z]);
1535 0.0, points[n][i - 1][
Z], 1.0,
1536 points[n][i][
Z], 0.0,
1537 points[
bnl][i - 1][
Z], 1.0,
1544 "crossing going down at surf %d no. %d",
1549 xing[
Y] = points[n][i - 1][
Y] +
1550 tx * (points[n][i][
Y] -
1551 points[n][i - 1][
Y]);
1552 xing[
X] = points[n][i - 1][
X] +
1553 tx * (points[n][i][
X] -
1554 points[n][i - 1][
X]);
1558 tx * (points[
bnl][i][
Z] -
1559 points[
bnl][i - 1][
Z]);
1566 tx * (points[
bn][i][
Z] -
1567 points[
bn][i - 1][
Z]);
1574 points[
bn][i - 1]) &&
1576 points[
bnl][i - 1])) {
1579 0.0, points[
bn][i - 1][
Z], 1.0,
1580 points[
bn][i][
Z], 0.0,
1581 points[
bnl][i - 1][
Z], 1.0,
1589 "lower crossing at surf %d no. %d "
1590 "between surfs %d & %d",
1595 tx * (points[
bn][i][
Y] -
1596 points[
bn][i - 1][
Y]);
1598 tx * (points[
bn][i][
X] -
1599 points[
bn][i - 1][
X]);
1601 z1 =
xing[
Z] = points[n][i - 1][
Z] +
1602 tx * (points[n][i][
Z] -
1603 points[n][i - 1][
Z]);
1618 if (!
upper && !lower) {
1619 G_debug(5,
"Crossing NOT found or masked:");
1621 " current surf: %d [ %.2f %.2f "
1622 "%.2f -> %.2f %.2f %f",
1623 n, points[n][i - 1][
X],
1624 points[n][i - 1][
Y],
1625 points[n][i - 1][
Z],
1626 points[n][i][
X], points[n][i][
Y],
1629 " below surf: %d [ %.2f %.2f %.2f "
1630 "-> %.2f %.2f %f\n",
1631 bn, points[
bn][i - 1][
X],
1632 points[
bn][i - 1][
Y],
1633 points[
bn][i - 1][
Z],
1634 points[
bn][i][
X], points[
bn][i][
Y],
1637 gs " last below surf: %d [ %.2f "
1638 "%.2f %.2f -> %.2f %.2f %f\n",
1640 points[
bnl][i - 1][
Y],
1641 points[
bnl][i - 1][
Z],
1658 if (!transpoint_is_masked(
gsurfs[n],
1659 points[n][i - 1]) &&
1661 points[
bn][i - 1])) {
1663 1.0, points[n][i][
Z], 0.0,
1664 points[
bn][i - 1][
Z], 1.0,
1665 points[
bn][i][
Z], &
tx,
1668 xing[
Y] = points[n][i - 1][
Y] +
1669 tx * (points[n][i][
Y] -
1670 points[n][i - 1][
Y]);
1671 xing[
X] = points[n][i - 1][
X] +
1672 tx * (points[n][i][
X] -
1673 points[n][i - 1][
X]);
1713 if (norm[
Z] > 0.0001 || norm[
Z] < -.0001) {
1723 for (n = 0; n <
nsurfs; n++) {
1732 if (npts !=
npts1) {
1733 G_warning(
_(
"Cut-plane points mismatch between surfaces. "
1734 "Check resolution(s)."));
1748 for (i = 0; i <
npts1; i++) {
1750 points[n][i][
X] +=
gsurfs[n]->x_trans;
1751 points[n][i][
Y] +=
gsurfs[n]->y_trans;
1752 points[n][i][
Z] +=
gsurfs[n]->z_trans;
1762 for (i = 0; i <
npts1; i++) {
1763 GS_v3eq(points[n][i], tmp[i]);
1766 points[n][i][
X] +=
gsurfs[n]->x_trans;
1767 points[n][i][
Y] +=
gsurfs[n]->y_trans;
1768 points[n][i][
Z] +=
gsurfs[n]->z_trans;
1773 for (n = 0; n <
nsurfs; n++) {
1783 for (n = 0; n <
nsurfs - 1; n++) {
1807 float x2, y1, y2,
tx,
ty, tz, sz;
1808 float n[3],
pt[4], xres, yres, ymax,
zexag;
1810#ifdef DO_ARROW_SOLID
1820 G_debug(3,
"gsd_norm_arrows");
1838#ifdef DO_ARROW_SOLID
1861 ymax = (
surf->rows - 1) *
surf->yres;
1873#ifdef DO_ARROW_SOLID
1881 for (row = 0; row <
ycnt; row++) {
1891 y1 = ymax - row * yres;
1892 y2 = ymax - (row + 1) * yres;
1919#ifdef DO_ARROW_SOLID
1940#ifdef DO_ARROW_SOLID
1960 x2 = (
col + 1) * xres;
2000#ifdef DO_ARROW_SOLID
2023#ifdef DO_ARROW_SOLID
2069 float n[3],
pt[4], xres, yres, ymax,
zexag;
2114 ymax = (
surf->rows - 1) *
surf->yres;
2129 window[0] += (
int)(yres * 4 *
zexag);
2130 window[1] -= (
int)(yres * 4 *
zexag);
2131 window[2] -= (
int)(xres * 4 *
zexag);
2132 window[3] += (
int)(xres * 4 *
zexag);
2236 y1 = ymax - row * yres;
2237 y2 = ymax - (row - (
step_val / 2)) * yres;
2309 for (
ii = 0;
ii < 10;
ii++) {
int BM_get(struct BM *, int, int)
Gets 'val' from the bitmap.
void G_free(void *)
Free allocated memory.
void G_warning(const char *,...) __attribute__((format(printf
int G_debug(int, const char *,...) __attribute__((format(printf
int gs_point_is_masked(geosurf *, float *)
Check if point is masked.
void gsd_endtfan(void)
ADD.
void gsd_endtmesh(void)
ADD.
void gsd_pushmatrix(void)
Push the current matrix stack.
Point3 * gsdrape_get_allsegments(geosurf *, float *, float *, int *)
Get all segments.
void GS_set_draw(int)
Sets which buffer to draw to.
void gsd_getwindow(int *, int *, double *, double *)
Get viewport.
int gs_getall_surfaces(geosurf **)
Get array of geosurf structs.
void gsd_do_scale(int)
Set current scale.
void GS_v3sub(float *, float *)
Subtract vectors.
void GS_v3mag(float *, float *)
Magnitude of vector.
int gs_get_att_src(geosurf *, int)
Get attribute source.
void gsd_bgnpolygon(void)
Delimit the vertices of a primitive or a group of like primitives.
int gs_calc_normals(geosurf *)
Calculate normals.
int segs_intersect(float, float, float, float, float, float, float, float, float *, float *)
Line intersect.
int gsd_checkpoint(float[4], int[4], int[4], double[16], double[16])
ADD.
void GS_v3eq(float *, float *)
Copy vector values.
int gs_mapcolor(typbuff *, gsurf_att *, int)
Call this one when you already know att_src is MAP_ATT.
int gs_update_curmask(geosurf *)
Update current maps.
void show_colormode(void)
Print color mode to stderr.
void gsd_translate(float, float, float)
Multiply the current matrix by a translation matrix.
void gsd_popmatrix(void)
Pop the current matrix stack.
void GS_v3cross(float *, float *, float *)
Get the cross product v3 = v1 cross v2.
void gsd_zwritemask(unsigned long)
Write out z-mask.
void gsd_colormode(int)
Set color mode.
typbuff * gs_get_att_typbuff(geosurf *, int, int)
Get attribute data buffer.
void GS_get_scale(float *, float *, float *, int)
Get axis scale.
void gsd_bgntfan(void)
ADD.
void gsd_set_material(int, int, float, float, int)
Set material.
void gsd_3darrow(float *, unsigned long, float, float, float *, float)
Draw 3d north arrow.
float gsdiff_do_SD(float, int)
ADD.
void gsd_blend(int)
Specify pixel arithmetic.
void gsd_bgntmesh(void)
ADD.
int GS_check_cancel(void)
Check for cancel.
int gsd_arrow(float *, unsigned long, float, float *, float, geosurf *)
Draws an arrow.
void gsd_endpolygon(void)
Delimit the vertices of a primitive or a group of like primitives.
geosurf * gsdiff_get_SDref(void)
ADD.
void gsd_litvert_func(float *, unsigned long, float *)
Set the current normal vector & specify vertex.
float GS_global_exag(void)
Get global z-exag value.
#define G_UNUSED
A macro for an attribute, if attached to a variable, indicating that the variable is not used.
int gsd_triangulated_wall(int npts1, int npts2, geosurf *surf1, geosurf *surf2, Point3 *points1, Point3 *points2, float *norm)
ADD.
int gsd_ortho_wall(int np, int ns, geosurf **gsurfs, Point3 **points, float *norm)
ADD.
void gsd_setfc(int mode)
ADD.
int gsd_norm_arrows(geosurf *surf)
ADD.
int gsd_surf_func(geosurf *gs, int(*user_func)(void))
Define user function.
int gsd_surf_const(geosurf *surf, float k)
Using tmesh - not confident with qstrips portability.
int gsd_surf_map(geosurf *surf)
Draw surface using triangle fan instead of strip.
int gsd_wall(float *bgn, float *end, float *norm)
ADD.
int gsd_surf(geosurf *surf)
ADD.
#define SET_SCOLOR(sf)
MACROS for use in gsd_ortho_wall ONLY !!!
int gsd_surf_map_old(geosurf *surf)
ADD.
#define SCALE_ATT(att, val, low, high)
#define GET_MAPATT(buff, offset, att)
OGSF header file (structures)
#define XY2OFF(gs, px, py)
SYMBOL * err(FILE *fp, SYMBOL *s, char *msg)