Skip to content

[math][GenVector] Add access operator for Rotation3D #18480

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

Merged
merged 2 commits into from
Apr 28, 2025
Merged
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
15 changes: 15 additions & 0 deletions math/genvector/inc/Math/GenVector/Rotation3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "Math/GenVector/RotationYfwd.h"
#include "Math/GenVector/RotationZfwd.h"

#include "Math/GenVector/GenVector_exception.h"

#include <algorithm>
#include <cassert>
Expand Down Expand Up @@ -345,6 +346,20 @@ class Rotation3D {

// =========== operations ==============

/**
Access operator, used to have direct access to rotation matrix's entries
\param i row index in {0,1,2}
\param j column index in {0,1,2}
*/
Scalar operator()(size_t i, size_t j) const
{
if (i < 3 && j < 3)
return fM[i + 3 * j];
else
GenVector::Throw("Rotation3D::operator(size_t i, size_t j):\n"
" indices i and j must range in {0,1,2}");
return 0.0;
}

/**
Rotation operation on a displacement vector in any coordinate system
Expand Down
Loading