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

DM-15139: Rename invert() and getInverse() to inverted() #10

Merged
merged 1 commit into from
Aug 12, 2018
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions include/lsst/geom/AffineTransform.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,15 @@ class AffineTransform {
AffineTransform(AffineTransform &&) noexcept = default;
~AffineTransform() noexcept = default;

//@{
/**
* Return the inverse transform
*
* @throws lsst::geom::SingularTransformException is not invertible
* @throws lsst::geom::SingularTransformException if not invertible
*/
AffineTransform const invert() const;
AffineTransform const inverted() const;
AffineTransform const invert() const { return inverted(); };
//@}

/** Whether the transform is a no-op. */
bool isIdentity() const noexcept { return getMatrix().isIdentity(); }
Expand Down
9 changes: 7 additions & 2 deletions include/lsst/geom/LinearTransform.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,17 @@ class LinearTransform {
double& operator[](int i) { return _matrix(i % 2, i / 2); }
double const& operator[](int i) const { return const_cast<Matrix&>(_matrix)(i % 2, i / 2); }

//@{
/**
* Return the inverse transform.
*
* @throws lsst::geom::SingularTransformException
* @deprecated invert is deprecated in favor of inverted
*
* @throws lsst::geom::SingularTransformException if not invertible
*/
LinearTransform const invert() const;
LinearTransform const inverted() const;
LinearTransform const invert() const { return inverted(); };
//@}

/**
* Return the determinant of the 2x2 matrix
Expand Down
1 change: 1 addition & 0 deletions python/lsst/geom/affineTransform.cc
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ PYBIND11_MODULE(affineTransform, mod) {
});

/* Members */
cls.def("inverted", &AffineTransform::inverted);
cls.def("invert", &AffineTransform::invert);
cls.def("isIdentity", &AffineTransform::isIdentity);
cls.def("getTranslation", (Extent2D & (AffineTransform::*)()) & AffineTransform::getTranslation);
Expand Down
1 change: 1 addition & 0 deletions python/lsst/geom/linearTransform.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ PYBIND11_MODULE(linearTransform, mod) {
cls.def("getParameterVector", &LinearTransform::getParameterVector);
cls.def("getMatrix",
(LinearTransform::Matrix const &(LinearTransform::*)() const) & LinearTransform::getMatrix);
cls.def("inverted", &LinearTransform::inverted);
cls.def("invert", &LinearTransform::invert);
cls.def("computeDeterminant", &LinearTransform::computeDeterminant);
cls.def("isIdentity", &LinearTransform::isIdentity);
Expand Down
2 changes: 1 addition & 1 deletion src/AffineTransform.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ AffineTransform::Matrix const AffineTransform::getMatrix() const noexcept {
return r;
}

AffineTransform const AffineTransform::invert() const {
AffineTransform const AffineTransform::inverted() const {
LinearTransform inv(getLinear().invert());
return AffineTransform(inv, -inv(getTranslation()));
}
Expand Down
2 changes: 1 addition & 1 deletion src/LinearTransform.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void LinearTransform::setParameterVector(LinearTransform::ParameterVector const&
(*this)[YY] = vector[YY];
}

LinearTransform const LinearTransform::invert() const {
LinearTransform const LinearTransform::inverted() const {
Eigen::FullPivLU<Matrix> lu(getMatrix());
if (!lu.isInvertible()) {
throw LSST_EXCEPT(SingularTransformException, "Could not compute LinearTransform inverse");
Expand Down