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 class3,polygon3d, that can initialise,
store and print any shape regular or irregular in Three-Dimensional (3D) 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.
2) Rotation and translation need not be defined in polygon3d. Therefore, turn the functions for
translation and rotation into pure virtual members, making polygon3d into an abstract base class.
Convert the private members of polygon3d into protected members to allow a layer of inheritance.
3) Create three new classes publicly inherited from polygon3d, called polygon_xy, polygon_xz
and polygon_yz. 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 polygon3ds translation /
rotation functions in each inherited class.
E.g. objects of the polygon_xy class can be translated by (1,2,0) but not by (1,2,5), since this would involve
an alteration of the z-coordinates i.e.movement in a plane other than an xy plane.
E.g. objects of the polygon_xy class can only be rotated in an xy plane again, z-coordinates cant be
altered by rotations, since this would entail movement in a plane other than an xy plane.
Similar rules apply for polygon_xz and polygon_yz 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 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!