diff --git a/src/geom/mod.rs b/src/geom/mod.rs index a40d6da..175aad2 100755 --- a/src/geom/mod.rs +++ b/src/geom/mod.rs @@ -11,7 +11,7 @@ pub fn det3x3t(a: &[f64], b: &[f64], c: &[f64]) -> f64 { ((a[0] - c[0]) * (b[1] - c[1])) - ((a[1] - c[1]) * (b[0] - c[0])) } -pub fn area_triangle(a: &[f64], b: &[f64], c: &[f64]) -> f64 { +pub fn area2d_triangle(a: &[f64], b: &[f64], c: &[f64]) -> f64 { det3x3t(a, b, c) / 2.0 } diff --git a/src/interpolation/mod.rs b/src/interpolation/mod.rs index 014f8ed..b748cdd 100755 --- a/src/interpolation/mod.rs +++ b/src/interpolation/mod.rs @@ -190,11 +190,11 @@ impl Interpolant for TIN { Ok(tr) => { let q: [f64; 3] = [p[0], p[1], 0.0]; let a0: f64 = - geom::area_triangle(&q, &dt.stars[tr.v[1]].pt, &dt.stars[tr.v[2]].pt); + geom::area2d_triangle(&q, &dt.stars[tr.v[1]].pt, &dt.stars[tr.v[2]].pt); let a1: f64 = - geom::area_triangle(&q, &dt.stars[tr.v[2]].pt, &dt.stars[tr.v[0]].pt); + geom::area2d_triangle(&q, &dt.stars[tr.v[2]].pt, &dt.stars[tr.v[0]].pt); let a2: f64 = - geom::area_triangle(&q, &dt.stars[tr.v[0]].pt, &dt.stars[tr.v[1]].pt); + geom::area2d_triangle(&q, &dt.stars[tr.v[0]].pt, &dt.stars[tr.v[1]].pt); let mut total = 0.; total += dt.stars[tr.v[0]].pt[2] * a0; total += dt.stars[tr.v[1]].pt[2] * a1; diff --git a/src/lib.rs b/src/lib.rs index 5a5258e..ba62c27 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -1793,7 +1793,7 @@ impl Triangulation { centres.push(vec![centres[0][0], centres[0][1]]); let mut totalarea = 0.0_f64; for c in centres.windows(2) { - totalarea += geom::area_triangle(&self.stars[vi].pt, &c[0], &c[1]); + totalarea += geom::area2d_triangle(&self.stars[vi].pt, &c[0], &c[1]); } Some(totalarea) }