42#define DEBUG_ARROW (0)
47#define SET_SCOLOR(sf) \
48 if (check_color[sf]) { \
49 tx = points[sf][i][X] - gsurfs[sf]->x_trans; \
50 ty = points[sf][i][Y] - gsurfs[sf]->y_trans; \
51 offset = XY2OFF(gsurfs[sf], tx, ty); \
52 colors[sf] = gs_mapcolor(cobuf[sf], coloratt[sf], offset); \
56static int get_point_below(
Point3 **,
geosurf **,
int,
int,
int,
int *);
146 float x1, x2, y1, y2,
tx,
ty, tz,
ttr;
147 float n[3],
pt[4], xres, yres, ymax,
zexag;
167 G_debug(3,
"gsd_surf_map_old");
195 ymax = (
surf->rows - 1) *
surf->yres;
203 window[0] += (
int)(yres * 2);
204 window[1] -= (
int)(yres * 2);
205 window[2] -= (
int)(xres * 2);
206 window[3] += (
int)(xres * 2);
298 for (row = 0; row <
ycnt; row++) {
310 y1 = ymax - row * yres;
311 y2 = ymax - (row + 1) * yres;
409 x2 = (
col + 1) * xres;
735 float x1, x2, y1, y2,
tx,
ty, tz;
736 float n[3],
pt[4], xres, yres, ymax,
zexag;
748 unsigned int ktrans = 255;
750 G_debug(5,
"gsd_surf_const(): id=%d",
surf->gsurf_id);
773 ymax = (
surf->rows - 1) *
surf->yres;
778 window[0] += (
int)(yres * 2);
779 window[1] -= (
int)(yres * 2);
780 window[2] -= (
int)(xres * 2);
781 window[3] += (
int)(xres * 2);
858 for (row = 0; row <
ycnt; row++) {
870 y1 = ymax - row * yres;
871 y2 = ymax - (row + 1) * yres;
929 x2 = (
col + 1) * xres;
1272 if (
gsurfs[n]->curmask) {
1273 if (transpoint_is_masked(
gsurfs[n], points[n][
ptn])) {
1334 for (n = 0; n < ns; ++n) {
1344 colors[n] =
gsurfs[n]->wire_color;
1387 for (n = 0; n < ns; ++n) {
1388 for (i = 0; i < np; i++) {
1411 if (!transpoint_is_masked(
gsurfs[n],
1412 points[n][i - 1]) &&
1414 points[
bn][i - 1])) {
1416 1.0, points[n][i][
Z], 0.0,
1417 points[
bn][i - 1][
Z], 1.0,
1418 points[
bn][i][
Z], &
tx,
1421 xing[
Y] = points[n][i - 1][
Y] +
1422 tx * (points[n][i][
Y] -
1423 points[n][i - 1][
Y]);
1424 xing[
X] = points[n][i - 1][
X] +
1425 tx * (points[n][i][
X] -
1426 points[n][i - 1][
X]);
1429 tx * (points[
bn][i][
Z] -
1430 points[
bn][i - 1][
Z]);
1442 while (i < np && 0 < (
bsret = get_point_below(
1500 if (!transpoint_is_masked(
gsurfs[n],
1501 points[n][i - 1]) &&
1503 points[
bnl][i - 1]) &&
1505 points[
bn][i - 1])) {
1508 0.0, points[n][i - 1][
Z], 1.0,
1509 points[n][i][
Z], 0.0,
1510 points[
bn][i - 1][
Z], 1.0,
1511 points[
bn][i][
Z], &
tx, &
ty)) {
1516 "crossing going up at surf %d no. %d",
1521 xing[
Y] = points[n][i - 1][
Y] +
1522 tx * (points[n][i][
Y] -
1523 points[n][i - 1][
Y]);
1524 xing[
X] = points[n][i - 1][
X] +
1525 tx * (points[n][i][
X] -
1526 points[n][i - 1][
X]);
1530 tx * (points[
bnl][i][
Z] -
1531 points[
bnl][i - 1][
Z]);
1539 0.0, points[n][i - 1][
Z], 1.0,
1540 points[n][i][
Z], 0.0,
1541 points[
bnl][i - 1][
Z], 1.0,
1548 "crossing going down at surf %d no. %d",
1553 xing[
Y] = points[n][i - 1][
Y] +
1554 tx * (points[n][i][
Y] -
1555 points[n][i - 1][
Y]);
1556 xing[
X] = points[n][i - 1][
X] +
1557 tx * (points[n][i][
X] -
1558 points[n][i - 1][
X]);
1562 tx * (points[
bnl][i][
Z] -
1563 points[
bnl][i - 1][
Z]);
1570 tx * (points[
bn][i][
Z] -
1571 points[
bn][i - 1][
Z]);
1578 points[
bn][i - 1]) &&
1580 points[
bnl][i - 1])) {
1583 0.0, points[
bn][i - 1][
Z], 1.0,
1584 points[
bn][i][
Z], 0.0,
1585 points[
bnl][i - 1][
Z], 1.0,
1593 "lower crossing at surf %d no. %d "
1594 "between surfs %d & %d",
1599 tx * (points[
bn][i][
Y] -
1600 points[
bn][i - 1][
Y]);
1602 tx * (points[
bn][i][
X] -
1603 points[
bn][i - 1][
X]);
1605 z1 =
xing[
Z] = points[n][i - 1][
Z] +
1606 tx * (points[n][i][
Z] -
1607 points[n][i - 1][
Z]);
1622 if (!
upper && !lower) {
1623 G_debug(5,
"Crossing NOT found or masked:");
1625 " current surf: %d [ %.2f %.2f "
1626 "%.2f -> %.2f %.2f %f",
1627 n, points[n][i - 1][
X],
1628 points[n][i - 1][
Y],
1629 points[n][i - 1][
Z],
1630 points[n][i][
X], points[n][i][
Y],
1633 " below surf: %d [ %.2f %.2f %.2f "
1634 "-> %.2f %.2f %f\n",
1635 bn, points[
bn][i - 1][
X],
1636 points[
bn][i - 1][
Y],
1637 points[
bn][i - 1][
Z],
1638 points[
bn][i][
X], points[
bn][i][
Y],
1641 gs " last below surf: %d [ %.2f "
1642 "%.2f %.2f -> %.2f %.2f %f\n",
1644 points[
bnl][i - 1][
Y],
1645 points[
bnl][i - 1][
Z],
1662 if (!transpoint_is_masked(
gsurfs[n],
1663 points[n][i - 1]) &&
1665 points[
bn][i - 1])) {
1667 1.0, points[n][i][
Z], 0.0,
1668 points[
bn][i - 1][
Z], 1.0,
1669 points[
bn][i][
Z], &
tx,
1672 xing[
Y] = points[n][i - 1][
Y] +
1673 tx * (points[n][i][
Y] -
1674 points[n][i - 1][
Y]);
1675 xing[
X] = points[n][i - 1][
X] +
1676 tx * (points[n][i][
X] -
1677 points[n][i - 1][
X]);
1717 if (norm[
Z] > 0.0001 || norm[
Z] < -.0001) {
1727 for (n = 0; n <
nsurfs; n++) {
1736 if (npts !=
npts1) {
1737 G_warning(
_(
"Cut-plane points mismatch between surfaces. "
1738 "Check resolution(s)."));
1752 for (i = 0; i <
npts1; i++) {
1754 points[n][i][
X] +=
gsurfs[n]->x_trans;
1755 points[n][i][
Y] +=
gsurfs[n]->y_trans;
1756 points[n][i][
Z] +=
gsurfs[n]->z_trans;
1766 for (i = 0; i <
npts1; i++) {
1767 GS_v3eq(points[n][i], tmp[i]);
1770 points[n][i][
X] +=
gsurfs[n]->x_trans;
1771 points[n][i][
Y] +=
gsurfs[n]->y_trans;
1772 points[n][i][
Z] +=
gsurfs[n]->z_trans;
1777 for (n = 0; n <
nsurfs; n++) {
1787 for (n = 0; n <
nsurfs - 1; n++) {
1811 float x2, y1, y2,
tx,
ty, tz, sz;
1812 float n[3],
pt[4], xres, yres, ymax,
zexag;
1814#ifdef DO_ARROW_SOLID
1824 G_debug(3,
"gsd_norm_arrows");
1842#ifdef DO_ARROW_SOLID
1865 ymax = (
surf->rows - 1) *
surf->yres;
1877#ifdef DO_ARROW_SOLID
1885 for (row = 0; row <
ycnt; row++) {
1895 y1 = ymax - row * yres;
1896 y2 = ymax - (row + 1) * yres;
1923#ifdef DO_ARROW_SOLID
1944#ifdef DO_ARROW_SOLID
1964 x2 = (
col + 1) * xres;
2004#ifdef DO_ARROW_SOLID
2027#ifdef DO_ARROW_SOLID
2073 float n[3],
pt[4], xres, yres, ymax,
zexag;
2118 ymax = (
surf->rows - 1) *
surf->yres;
2133 window[0] += (
int)(yres * 4 *
zexag);
2134 window[1] -= (
int)(yres * 4 *
zexag);
2135 window[2] -= (
int)(xres * 4 *
zexag);
2136 window[3] += (
int)(xres * 4 *
zexag);
2240 y1 = ymax - row * yres;
2241 y2 = ymax - (row - (
step_val / 2)) * yres;
2313 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 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)