Skip to content

Commit a39b6e6

Browse files
committed
refactor(polynomial)!: Remove fn are_colinear_3
This helper function is not used in downstream dependencies, and it's easy to use method `are_colinear` in its stead.
1 parent a5cbc60 commit a39b6e6

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

twenty-first/src/math/polynomial.rs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -254,17 +254,6 @@ where
254254
self.evaluate::<FF, FF>(x)
255255
}
256256

257-
pub fn are_colinear_3(p0: (FF, FF), p1: (FF, FF), p2: (FF, FF)) -> bool {
258-
if p0.0 == p1.0 || p1.0 == p2.0 || p2.0 == p0.0 {
259-
return false;
260-
}
261-
262-
let dy = p0.1 - p1.1;
263-
let dx = p0.0 - p1.0;
264-
265-
dx * (p2.1 - p0.1) == dy * (p2.0 - p0.0)
266-
}
267-
268257
pub fn are_colinear(points: &[(FF, FF)]) -> bool {
269258
if points.len() < 3 {
270259
return false;
@@ -2887,7 +2876,7 @@ mod test_polynomials {
28872876
) {
28882877
let line = Polynomial::lagrange_interpolate_zipped(&[p0, p1]);
28892878
let p2 = (p2_x, line.evaluate(p2_x));
2890-
prop_assert!(Polynomial::are_colinear_3(p0, p1, p2));
2879+
prop_assert!(Polynomial::are_colinear(&[p0, p1, p2]));
28912880
}
28922881

28932882
#[proptest]
@@ -2899,7 +2888,7 @@ mod test_polynomials {
28992888
) {
29002889
let line = Polynomial::lagrange_interpolate_zipped(&[p0, p1]);
29012890
let p2 = (p2_x, line.evaluate_in_same_field(p2_x) + disturbance);
2902-
prop_assert!(!Polynomial::are_colinear_3(p0, p1, p2));
2891+
prop_assert!(!Polynomial::are_colinear(&[p0, p1, p2]));
29032892
}
29042893

29052894
#[proptest]

0 commit comments

Comments
 (0)