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;