GRASS GIS 8 Programmer's Manual
8.5.0dev(2024)-d6dec75dd4
|
OGSF library - query (lower level functions) More...
Go to the source code of this file.
Macros | |
#define | HUGE_VAL 1.7976931348623157e+308 |
Values needed for Ray-Convex Polyhedron Intersection Test below originally by Eric Haines, erich. @eye .comMore... | |
#define | MISSED 0 |
#define | FRONTFACE 1 |
#define | BACKFACE -1 |
Functions | |
int | gs_los_intersect1 (int surfid, float(*los)[3], float *point) |
Crude method of intersecting line of sight with closest part of surface. More... | |
int | gs_los_intersect (int surfid, float **los, float *point) |
Crude method of intersecting line of sight with closest part of surface. More... | |
int | RayCvxPolyhedronInt (Point3 org, Point3 dir, double tmax, Point4 *phdrn, int ph_num, double *tresult, int *pn) |
Ray-Convex Polyhedron Intersection Test. More... | |
void | gs_get_databounds_planes (Point4 *planes) |
Get data bounds for plane. More... | |
int | gs_setlos_enterdata (Point3 *los) |
OGSF library - query (lower level functions)
GRASS OpenGL gsurf OGSF Library
(C) 1999-2008 by the GRASS Development Team
This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.
Definition in file gs_query.c.
#define BACKFACE -1 |
Definition at line 35 of file gs_query.c.
#define FRONTFACE 1 |
Definition at line 34 of file gs_query.c.
#define HUGE_VAL 1.7976931348623157e+308 |
Values needed for Ray-Convex Polyhedron Intersection Test below originally by Eric Haines, erich. @eye .com
Definition at line 29 of file gs_query.c.
#define MISSED 0 |
Definition at line 33 of file gs_query.c.
void gs_get_databounds_planes | ( | Point4 * | planes | ) |
Get data bounds for plane.
[out] | planes |
Definition at line 469 of file gs_query.c.
Referenced by gs_setlos_enterdata().
int gs_los_intersect | ( | int | surfid, |
float ** | los, | ||
float * | point | ||
) |
Crude method of intersecting line of sight with closest part of surface.
This version uses the shadow of the los projected down to the surface to generate a line_on_surf, then follows each point in that line until the los intersects it.
surfid | surface id | |
los | should be in surf-world coordinates | |
[out] | point | intersect point (real) |
Definition at line 192 of file gs_query.c.
int gs_los_intersect1 | ( | int | surfid, |
float(*) | los[3], | ||
float * | point | ||
) |
Crude method of intersecting line of sight with closest part of surface.
Uses los vector to determine the point of first intersection which is returned in point. Returns 0 if los doesn't intersect.
surfid | surface id | |
los | should be in surf-world coordinates | |
[out] | point | intersect point (real) |
Definition at line 52 of file gs_query.c.
int gs_setlos_enterdata | ( | Point3 * | los | ) |
Gets all current cutting planes & data bounding planes
Intersects los with resulting convex polyhedron, then replaces los[FROM] with first point on ray inside data.
[out] | los |
Definition at line 529 of file gs_query.c.
References FROM, FRONTFACE, GS_distance(), gs_get_databounds_planes(), GS_v3add(), GS_v3dir(), GS_v3mult(), gsd_get_cplanes(), MISSED, RayCvxPolyhedronInt(), and TO.
int RayCvxPolyhedronInt | ( | Point3 | org, |
Point3 | dir, | ||
double | tmax, | ||
Point4 * | phdrn, | ||
int | ph_num, | ||
double * | tresult, | ||
int * | pn | ||
) |
Ray-Convex Polyhedron Intersection Test.
Originally by Eric Haines, erich @eye .com
This test checks the ray against each face of a polyhedron, checking whether the set of intersection points found for each ray-plane intersection overlaps the previous intersection results. If there is no overlap (i.e. no line segment along the ray that is inside the polyhedron), then the ray misses and returns 0; else 1 is returned if the ray is entering the polyhedron, -1 if the ray originates inside the polyhedron. If there is an intersection, the distance and the number of the face hit is returned.
org,dir | origin and direction of ray | |
tmax | maximum useful distance along ray | |
phdrn | list of planes in convex polyhedron | |
ph_num | number of planes in convex polyhedron | |
[out] | tresult | distance of intersection along ray |
[out] | pn | number of face hit (0 to ph_num-1) |
Definition at line 384 of file gs_query.c.
References BACKFACE, DOT3, FRONTFACE, HUGE_VAL, MISSED, t, and W.
Referenced by gs_setlos_enterdata().