//# Euler.cc: Vector of Euler rotation angles //# Copyright (C) 1995,1996,1997,1998,1999,2000 //# Associated Universities, Inc. Washington DC, USA. //# //# This library is free software; you can redistribute it and/or modify it //# under the terms of the GNU Library General Public License as published by //# the Free Software Foundation; either version 2 of the License, or (at your //# option) any later version. //# //# This library is distributed in the hope that it will be useful, but WITHOUT //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public //# License for more details. //# //# You should have received a copy of the GNU Library General Public License //# along with this library; if not, write to the Free Software Foundation, //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. //# //# Correspondence concerning AIPS++ should be addressed as follows: //# Internet email: aips2-request@nrao.edu. //# Postal address: AIPS++ Project Office //# National Radio Astronomy Observatory //# 520 Edgemont Road //# Charlottesville, VA 22903-2475 USA //# //# $Id$ //# Includes #include #include #include #include #include #include #include namespace casacore { //# NAMESPACE CASACORE - BEGIN // Euler class //# Constructors Euler::Euler() : euler(3), axes(3) { euler = Double(0.0); indgen(axes,1,1); } Euler::Euler(const Euler &other) : euler(3), axes(3) { euler = other.euler; axes = other.axes; } Euler &Euler::operator=(const Euler &other) { if (this != &other) { euler = other.euler; axes = other.axes; } return *this; } Euler::Euler(Double in0, Double in1, Double in2) : euler(3), axes(3) { euler(0) = in0; euler(1) = in1; euler(2) = in2; indgen(axes,1,1); } Euler::Euler(Double in0, uInt ax0, Double in1, uInt ax1, Double in2, uInt ax2) : euler(3), axes(3) { DebugAssert(ax0 <= 3 && ax1 <=3 && ax2 <=3, AipsError); euler(0) = in0; euler(1) = in1; euler(2) = in2; axes(0) = ax0; axes(1) = ax1; axes(2) = ax2; } Euler::Euler(const Quantity &in0) : euler(3), axes(3) { euler(0) = Euler::makeRad(in0); euler(1) = 0; euler(2) = 0; indgen(axes,1,1); } Euler::Euler(const Quantity &in0, const Quantity &in1) : euler(3), axes(3) { euler(0) = Euler::makeRad(in0); euler(1) = Euler::makeRad(in1); euler(2) = 0; indgen(axes,1,1); } Euler::Euler(const Quantity &in0, const Quantity &in1, const Quantity &in2) : euler(3), axes(3) { euler(0) = Euler::makeRad(in0); euler(1) = Euler::makeRad(in1); euler(2) = Euler::makeRad(in2); indgen(axes,1,1); } Euler::Euler(const Quantity &in0, uInt ax0) : euler(3), axes(3) { DebugAssert(ax0 <= 3, AipsError); euler(0) = Euler::makeRad(in0); euler(1) = 0; euler(2) = 0; axes(0) = ax0; axes(1) = 0; axes(2) = 0; } Euler::Euler(const Quantity &in0, uInt ax0, const Quantity &in1, uInt ax1) : euler(3), axes(3) { DebugAssert(ax0 <= 3 && ax1 <=3, AipsError); euler(0) = Euler::makeRad(in0); euler(1) = Euler::makeRad(in1); euler(2) = 0; axes(0) = ax0; axes(1) = ax1; axes(2) = 0; } Euler::Euler(const Quantity &in0, uInt ax0, const Quantity &in1, uInt ax1, const Quantity &in2, uInt ax2) : euler(3), axes(3) { DebugAssert(ax0 <= 3 && ax1 <=3 && ax2 <=3, AipsError); euler(0) = Euler::makeRad(in0); euler(1) = Euler::makeRad(in1); euler(2) = Euler::makeRad(in2); axes(0) = ax0; axes(1) = ax1; axes(2) = ax2; } Euler::Euler(const Quantum > &in) : euler(3), axes(3) { Int i; Vector tmp = Euler::makeRad(in); Int j=tmp.size(); j=min(j,3); for (i=0; i > &in, const Vector &ax) : euler(3), axes(3) { Vector tmp = Euler::makeRad(in); Int j=tmp.size(); j=min(j,3); Int i=ax.size(); j=min(j,i); for (i=0; i Euler::makeRad(const Quantum > &in) { in.assure(UnitVal::ANGLE); return in.get().getValue(); } Quantum > Euler::getAngle() const { return Quantum >(euler,"rad"); } Quantum > Euler::getAngle(const Unit &unit) const { return Quantum >(euler,"rad").get(unit); } void Euler::set(uInt which, uInt ax) { DebugAssert(which < 3 && ax <=3, AipsError); axes(which) = ax; } void Euler::set(uInt ax0, uInt ax1, uInt ax2) { DebugAssert(ax0 <= 3 && ax1 <=3 && ax2 <= 3, AipsError); axes(0) = ax0; axes(1) = ax1; axes(2) = ax2; } Int Euler::get(uInt which) const{ DebugAssert(which < 3, AipsError); return axes(which); } ostream &operator<<(ostream &os, const Euler &eul) { os << eul.euler; return os; } } //# NAMESPACE CASACORE - END