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 coordinates: and The class must provide
the following functions:
translate int d char axis is the distance the point will move in the given axis. axis can have one
of the following values: and If any other value is given, the function should do nothing
and return If an invalid value is given for d the function should do nothing and return Invalid
values for could be anything other than an integer value. The function returns if everything is
valid and the point is translated.
Develop a class Triangle. A triangle consists of 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 vertex and vertex
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
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.
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
