Question: Copy and alter your class polygon to create a new class 3 , polygon 3 d , that can initialise, store and print any shape
Copy and alter your class polygon to create a new classpolygond that can initialise,
store and print any shape regular or irregular in ThreeDimensional D space. Get rid of the
member variable for radius, which is no longer meaningful, and alter the constructor function so that it
now directly accepts and store the coordinates of the vertices. Delete N too. Dont make other changes
yet.
Rotation and translation need not be defined in polygond Therefore, turn the functions for
translation and rotation into pure virtual members, making polygond into an abstract base class.
Convert the private members of polygond into protected members to allow a layer of inheritance.
Create three new classes publicly inherited from polygond called polygonxy polygonxz
and polygonyz Each class must only be able to perform rotations and translations in its own active
set of planes defined by xy xz or yz You should achieve this by overriding polygonds translation
rotation functions in each inherited class.
Eg objects of the polygonxy class can be translated by but not by since this would involve
an alteration of the zcoordinates iemovement in a plane other than an xy plane.
Eg objects of the polygonxy class can only be rotated in an xy plane again, zcoordinates cant be
altered by rotations, since this would entail movement in a plane other than an xy plane.
Similar rules apply for polygonxz and polygonyz in accordance with the planes given in their name
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
