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

AP_Math: move zeroing to header, use memset, reuse in identity #28423

Merged
merged 1 commit into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions libraries/AP_Math/matrix3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,14 +227,6 @@ bool Matrix3<T>::invert()
return success;
}

template <typename T>
void Matrix3<T>::zero(void)
{
a.x = a.y = a.z = 0;
b.x = b.y = b.z = 0;
c.x = c.y = c.z = 0;
}

// create rotation matrix for rotation about the vector v by angle theta
// See: http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToMatrix/
template <typename T>
Expand Down
8 changes: 4 additions & 4 deletions libraries/AP_Math/matrix3.h
Original file line number Diff line number Diff line change
Expand Up @@ -219,14 +219,14 @@ class Matrix3 {
bool invert() WARN_IF_UNUSED;

// zero the matrix
void zero(void);
void zero(void) {
memset((void*)this, 0, sizeof(*this));
}

// setup the identity matrix
void identity(void) {
zero();
a.x = b.y = c.z = 1;
a.y = a.z = 0;
b.x = b.z = 0;
c.x = c.y = 0;
}

// check if any elements are NAN
Expand Down
Loading