Skip to content

Commit

Permalink
Renamed Cap::from_points to Cap::from_triangle
Browse files Browse the repository at this point in the history
  • Loading branch information
ofmooseandmen committed Dec 3, 2023
1 parent a038a9e commit 3a14cf6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
### 0.12.0

- Is position within distance to the boundary of loop?
- Renamed Cap::from_points to Cap::from_triangle

### 0.11.0

Expand Down
8 changes: 4 additions & 4 deletions src/spherical/cap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ impl Cap {

/// Constructs a new cap whose boundary passes by the 3 given points: the returned cap is the circumcircle of the
/// triangle defined by the 3 given points.
pub fn from_points(a: NVector, b: NVector, c: NVector) -> Self {
pub fn from_triangle(a: NVector, b: NVector, c: NVector) -> Self {
// see STRIPACK: http://orion.math.iastate.edu/burkardt/f_src/stripack/stripack.f90
// 3 points must be in anti-clockwise order
let clockwise = Sphere::side(a, b, c) < 0;
Expand Down Expand Up @@ -327,16 +327,16 @@ mod tests {
}

#[test]
fn from_points() {
fn from_triangle() {
let a = NVector::from_lat_long_degrees(0.0, 0.0);
let b = NVector::from_lat_long_degrees(20.0, 0.0);
let c = NVector::from_lat_long_degrees(10.0, 10.0);
let cap = Cap::from_points(a, b, c);
let cap = Cap::from_triangle(a, b, c);
assert!(cap.contains_point(a));
assert!(cap.contains_point(b));
assert!(cap.contains_point(c));

let o = Cap::from_points(c, b, a);
let o = Cap::from_triangle(c, b, a);
assert_nv_eq_d7(o.centre, cap.centre);
assert!((o.chord_radius2 - cap.chord_radius2).abs() < 1e-16);
}
Expand Down

0 comments on commit 3a14cf6

Please sign in to comment.