Astro 503, Spring 2006 Homework #6 Due Tuesday, Feb 21 1. Create a class called Rotation3d which represents members of the 3d rotation group SO(3). Recall that the properties of any group are that there is an operation (which we'll overload on the * symbol) such that c = a*b is a member of the group if a and b are; there is an identity element I such that a*I = a for all a; and that every element has a unique inverse such that aInv * a = I. The public part of the class definition allows your client to create a Rotation3d by specifying the 3 Euler angles (see http://mathworld.wolfram.com/EulerAngles.html) and the write() method will spit the 3 Euler angles to the designated ostream. Implement your Rotation3d class by having a private member element that is the 3x3 matrix representation of the rotation. So here's the class definition: class Rotation3d { public: Rotation3d(double phi, double theta, double psi); void write(ostream& os) const; Rotation3d operator*(const Rotation3d& rhs); Rotation3d operator-() const; static Rotation3d identity(); private: Matrix3x3 m; }; After you all the class code, write a simple driver program that illustrates the ability to add two Rotation3d elements in SO(3), and shows that the group is non-Abelian (a*b does not always equal b*a). 2. Write a new set of classes to represent 3x3 matrices. There is an abstract base class class Matrix3x3 { public: virtual ~Matrix3x3() {} virtual double getElement(int i, int j)=0; virtual Matrix3x3* inversePtr() const =0; }; Then write three derived classes: class Symmetric3x3: public Matrix3x3; class Diagonal3x3: public Matrix3x3; class General3x3: public Matrix3x3; such that each has its own internal representation of the matrix that uses the minimal required amount of storage space, and has a constructor that lets you build the appropriate kind of matrix. The virtual functions should be implemented for each of these 3 concrete derived classes. Don't bother writing any other methods for this matrix class, just the element access and the inverse function. 3. Describe why the ProductFunction1d class used in class has bad "ownership issues," meaning it will be tough to make sure that everything is properly destroyed during program execution.