Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started