Skip to content

Commit

Permalink
Rename area_triangle() to area2d_triangle()
Browse files Browse the repository at this point in the history
  • Loading branch information
hugoledoux committed Jul 16, 2024
1 parent b517bd5 commit cb37803
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/geom/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
6 changes: 3 additions & 3 deletions src/interpolation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit cb37803

Please sign in to comment.