Question: OpenGL C + + Develop a class Point. A point is represented by 3 coordinates: x , y , and z . The class must

OpenGL
C++
Develop a class Point. A point is represented by 3 coordinates: x,y, and z. The class must provide
the following functions:
translate (int d, char axis).d is the distance the point will move in the given axis. axis can have one
of the following 3 values: 'x','y', and 'z'. If any other value is given, the function should do nothing
and return -1. If an invalid value is given for d, the function should do nothing and return -2. Invalid
values for d could be anything other than an integer value. The function returns 0 if everything is
valid and the point is translated.
Develop a class Triangle. A triangle consists of 3 Points. In the implementation of the attributes of
the triangle class, you must represent the three points as pointers to Point. You may name them
vertex_1, vertex_2, and vertex_3.
Implement a method translate (int d, char axis) that translates the three vertices of the triangle by d
in the direction of the given axis.
Implement a function to calculate the area of the triangle. Name it calcArea(). You decide its return
type.
Develop a constructor that takes three points as parameters.
Develop a default constructor that sets the three pointers to the three points to null.
Feel free to add any other functions that you see fit. Maybe a display function in Point or
Triangle??!! You decide 3.
Both the Point class and the Triangle class must have destructors.
Develop a driver class that allows the user to create a triangle and to translate the triangle. You
need to provide a menu option to display the triangle coordinates on the screen.
 OpenGL C++ Develop a class Point. A point is represented by

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 Databases Questions!