20 #include <grass/Vect.h>
37 double tx,
double ty,
double *tz,
double *angle,
double *slope)
39 int i, area, n_points;
40 struct Plus_head *Plus;
42 static struct line_pnts *Points;
43 static int first_time = 1;
45 double vx1, vx2, vy1, vy2, vz1, vz2;
51 if (first_time == 1) {
57 G_debug(3,
"TIN: area = %d", area);
61 Area = Plus->Area[area];
62 if (Area->n_isles > 0)
66 n_points = Points->n_points;
73 for (i = 0; i < 3; i++) {
74 G_debug(3,
"TIN: %d %f %f %f", i, x[i], y[i], z[i]);
84 a = vy1 * vz2 - vy2 * vz1;
85 b = vz1 * vx2 - vz2 * vx1;
86 c = vx1 * vy2 - vx2 * vy1;
87 d = -a * x[0] - b * y[0] - c * z[0];
90 *tz = -(d + a * tx + b * ty) / c;
struct line_pnts * Vect_new_line_struct()
Creates and initializes a struct line_pnts.
int Vect_get_area_points(struct Map_info *Map, int area, struct line_pnts *BPoints)
Returns the polygon array of points in BPoints.
int Vect_find_area(struct Map_info *Map, double x, double y)
Find the nearest area.
int G_debug(int level, const char *msg,...)
Print debugging message.
int Vect_tin_get_z(struct Map_info *Map, double tx, double ty, double *tz, double *angle, double *slope)
Calculates z coordinate for point from TIN.