Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements #50

Merged
merged 11 commits into from
Dec 25, 2024
Prev Previous commit
Next Next commit
Manually implement partial eq
  • Loading branch information
ranjeethmahankali committed Dec 23, 2024
commit c563e7afe57b9356d88fe77529f931f920c0ff9d
20 changes: 19 additions & 1 deletion src/decimate/quadric.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use std::ops::{Add, AddAssign, Div, Mul, Neg, Sub};

// Credit to:
// https://github.com/Philip-Trettner/probabilistic-quadrics/blob/master/probabilistic-quadrics.hh
#[derive(PartialEq)]
pub struct Quadric<A>
where
A: Adaptor<3>,
Expand All @@ -24,6 +23,25 @@ where
c: A::Scalar,
}

impl<A> PartialEq for Quadric<A>
where
A: Adaptor<3>,
A::Scalar: PartialEq,
{
fn eq(&self, other: &Self) -> bool {
self.a00 == other.a00
&& self.a01 == other.a01
&& self.a02 == other.a02
&& self.a11 == other.a11
&& self.a12 == other.a12
&& self.a22 == other.a22
&& self.b0 == other.b0
&& self.b1 == other.b1
&& self.b2 == other.b2
&& self.c == other.c
}
}

impl<A> Default for Quadric<A>
where
A: FloatScalarAdaptor<3>,
Expand Down