IAP GITLAB

Skip to content
Snippets Groups Projects
Commit ccb8db9c authored by Maximilian Reininghaus's avatar Maximilian Reininghaus :vulcan: Committed by Maximilian Reininghaus
Browse files

comparisons of CS via pointers

parent 8a317705
No related branches found
No related tags found
1 merge request!420Some improvements regarding coordinate systems
......@@ -24,46 +24,22 @@ namespace corsika {
}
inline LengthType Point::getX(CoordinateSystemPtr const& pCS) const {
CoordinateSystemPtr const& cs = BaseVector<length_d>::getCoordinateSystem();
if (*pCS == *cs) {
return BaseVector<length_d>::getQuantityVector().getX();
} else {
return QuantityVector<length_d>(
get_transformation(*cs.get(), *pCS.get()) *
BaseVector<length_d>::getQuantityVector().eigenVector_)
.getX();
}
return getCoordinates(pCS).getX();
}
inline LengthType Point::getY(CoordinateSystemPtr const& pCS) const {
CoordinateSystemPtr const& cs = BaseVector<length_d>::getCoordinateSystem();
if (*pCS == *cs) {
return BaseVector<length_d>::getQuantityVector().getY();
} else {
return QuantityVector<length_d>(
get_transformation(*cs.get(), *pCS.get()) *
BaseVector<length_d>::getQuantityVector().eigenVector_)
.getY();
}
return getCoordinates(pCS).getY();
}
inline LengthType Point::getZ(CoordinateSystemPtr const& pCS) const {
CoordinateSystemPtr const& cs = BaseVector<length_d>::getCoordinateSystem();
if (*pCS == *cs) {
return BaseVector<length_d>::getQuantityVector().getZ();
} else {
return QuantityVector<length_d>(
get_transformation(*cs.get(), *pCS.get()) *
BaseVector<length_d>::getQuantityVector().eigenVector_)
.getZ();
}
return getCoordinates(pCS).getZ();
}
/// this always returns a QuantityVector as triple
inline QuantityVector<length_d> Point::getCoordinates(
CoordinateSystemPtr const& pCS) const {
CoordinateSystemPtr const& cs = BaseVector<length_d>::getCoordinateSystem();
if (*pCS == *cs) {
if (pCS == cs) {
return BaseVector<length_d>::getQuantityVector();
} else {
return QuantityVector<length_d>(
......@@ -74,7 +50,7 @@ namespace corsika {
/// this always returns a QuantityVector as triple
inline QuantityVector<length_d>& Point::getCoordinates(CoordinateSystemPtr const& pCS) {
if (*pCS != *BaseVector<length_d>::getCoordinateSystem()) { rebase(pCS); }
if (pCS != BaseVector<length_d>::getCoordinateSystem()) { rebase(pCS); }
return BaseVector<length_d>::getQuantityVector();
}
......@@ -106,4 +82,4 @@ namespace corsika {
return (p1 - p2).getNorm();
}
} // namespace corsika
\ No newline at end of file
} // namespace corsika
......@@ -27,7 +27,7 @@ namespace corsika {
template <typename TDimension>
inline QuantityVector<TDimension> Vector<TDimension>::getComponents(
CoordinateSystemPtr const& pCS) const {
if (*pCS == *BaseVector<TDimension>::getCoordinateSystem()) {
if (pCS == BaseVector<TDimension>::getCoordinateSystem()) {
return BaseVector<TDimension>::getQuantityVector();
} else {
return QuantityVector<TDimension>(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment