Define Copy Constructor B Create Two Parameter Mutator Method C Overload Operator Vec3 Mul Q37298198

4. Using the following code fragment for a vector with three dimensions, complete the required methods in each space provided

a) Define the copy constructor:

b) Create a two parameter mutator method:

c) Overload the * operator such that when the Vec3 is multipliedby a float it returns a scaled Vec3 object (e.g. Vec3(1,2,3) * 2 ==Vec3(2,4,6)):

d) Create a normalize method which modifies the vector’s currentvalues to unit length. That is, the normalize function adjusts theexisting values in the Vec3 object such that the length from theorigin at 0,0,0 to the point defined in Vec3 is one unit. Hint:Pythagoras

e)

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.