Question: Write prototypes and implementations for 3 non - member functions named R 1 , R 2 , and R 3 that each accept an angle

Write prototypes and implementations for 3 non-member functions named R1, R2, and R3 that
each accept an angle in units of radians and return objects of the Matrix class corresponding to the
following rotation matrices that rotate clockwise about the 1,2,3 or x,y,z axes:
1()=[
100
0 cos sin
0sin cos
]
2()=[
cos0sin
010
sin0 cos
]
3()=[
cos sin0
sin cos0
001
]
(Note that you may see different versions of these rotation matrices with the other sin element
being negative, this is due to rotation in a different direction)
4. To perform arithmetic operations on matrices, you can use non-member functions, member
functions, or overloaded operators (which are a special type of member function where the function
name is the operator and the syntax for calling the function uses the operator.) Three non-member
functions have the following prototypes:Matrix Multiply(const Matrix& A, const Matrix& B);
Matrix Multiply(const Matrix& A, double k);
Matrix Add(const Matrix& A, Matrix& B);
The second multiply function is an overload because multiply is different when you are
multiplying a Matrix by a scalar (different in both linear algebra and in C++, we need to tell the
compiler how to do this)
a. Write prototypes for the corresponding member functions. These member functions
should not change the matrix object, but should ask the Matrix object to determine and
return the results of:
i. multiplying itself by another matrix,
ii. multiplying itself by a scalar (a double)
iii. adding itself to another matrix.
b. Write prototypes of member functions that overload the * and + operators for the same
three cases listed above

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!