29#define HUGE_VAL 1.7976931348623157e+308
54 float dx, dy, dz, u_d[3];
55 float a[3], incr,
min_incr, tlen, len;
61 G_debug(3,
"gs_los_intersect1():");
89 b[
X] = a[
X] -
gs->x_trans;
90 b[
Y] = a[
Y] -
gs->y_trans;
110 b[
X] = a[
X] -
gs->x_trans;
111 b[
Y] = a[
Y] -
gs->y_trans;
134 b[
X] = a[
X] -
gs->x_trans;
135 b[
Y] = a[
Y] -
gs->y_trans;
164 if ((edge) && (
b[
Z] - (a[
Z] + dz * 2.0) > incr * u_d[
Z])) {
165 G_debug(3,
" looking under surface");
172 point[
Z] =
b[
Z] -
gs->z_trans;
195 float p1, p2, u_d[3];
198 float bgn[3], end[3], a1[3];
203 G_debug(3,
"gs_los_intersect");
221 end[
X] -=
gs->x_trans;
222 end[
Y] -=
gs->y_trans;
261 G_debug(3,
" %d points to check", num);
269 incr = ((points[0][
X] - (
los[
FROM][
X] -
gs->x_trans)) / u_d[
X]);
272 incr = ((points[0][
Y] - (
los[
FROM][
Y] -
gs->y_trans)) / u_d[
Y]);
297 if (a[
Z] < points[0][
Z]) {
312 for (i = 1; i < num; i++) {
314 incr = ((points[i][
X] - a1[
X]) / u_d[
X]);
317 incr = ((points[i][
Y] - a1[
Y]) / u_d[
Y]);
320 a[
X] = a1[
X] + (incr * u_d[
X]);
321 a[
Y] = a1[
Y] + (incr * u_d[
Y]);
322 a[
Z] = a1[
Z] + (incr * u_d[
Z]);
323 above = (a[
Z] >= points[i][
Z]);
338 incr = ((a[
X] -
b[
X]) / u_d[
X]);
341 incr = ((a[
Y] -
b[
Y]) / u_d[
Y]);
345 1.0, a[
Z], 0.0,
b[
Z], &
p1, &p2))) {
346 point[
X] = points[i - 1][
X] + (u_d[
X] * incr *
p1);
347 point[
Y] = points[i - 1][
Y] + (u_d[
Y] * incr *
p1);
471 float n, s, w, e,
b,
t;
int G_debug(int, const char *,...) __attribute__((format(printf
void GS_v3mult(float *, float)
Multiple vectors.
Point3 * gsdrape_get_allsegments(geosurf *, float *, float *, int *)
Get all segments.
int gs_get_yrange(float *, float *)
Get y-range.
int GS_get_zrange(float *, float *, int)
Get z-extent for all loaded surfaces.
int gsd_get_cplanes(Point4 *)
Get cplaces.
void GS_v3add(float *, float *)
Sum vectors.
geosurf * gs_get_surf(int)
Get geosurf struct.
int segs_intersect(float, float, float, float, float, float, float, float, float *, float *)
Line intersect.
void GS_v3eq(float *, float *)
Copy vector values.
int gs_get_xrange(float *, float *)
Get x-range.
int viewcell_tri_interp(geosurf *, typbuff *, Point3, int)
ADD.
typbuff * gs_get_att_typbuff(geosurf *, int, int)
Get attribute data buffer.
int GS_v3dir(float *, float *, float *)
Get a normalized direction from v1 to v2, store in v3.
float GS_distance(float *, float *)
Calculate distance.
void gs_get_databounds_planes(Point4 *planes)
Get data bounds for plane.
int gs_los_intersect1(int surfid, float(*los)[3], float *point)
Crude method of intersecting line of sight with closest part of surface.
int gs_setlos_enterdata(Point3 *los)
int gs_los_intersect(int surfid, float **los, float *point)
Crude method of intersecting line of sight with closest part of surface.
#define HUGE_VAL
Values needed for Ray-Convex Polyhedron Intersection Test below originally by Eric Haines,...
int RayCvxPolyhedronInt(Point3 org, Point3 dir, double tmax, Point4 *phdrn, int ph_num, double *tresult, int *pn)
Ray-Convex Polyhedron Intersection Test.
OGSF header file (structures)