The vertices are defined in the Vertex class and the vectors in Vector3D class
the task
Screenshot_216.png
Screenshot_217.png
I put the declaration of the function in the Vertex header (and her body in the Vertex class) because it needs to be called from the vertices
Expand|Select|Wrap|Line Numbers
- // The decleration in the Vertex header
- Vector3D VecSub(Vertex const &other);
- //The body in the Vertex Class
- Vector3D Vertex::VecSub(Vertex const &other)
- {
- Vertex a;
- Vertex b;
- Vertex sub = a - b;
- Vector3D temp(sub.GetX(), sub.GetY(), sub.GetZ());;
- return temp;
- }
- //The use of the function in the model class
- Vector3D vectorA = vertex1.VecSub(vertex0);
- Vector3D vectorB = vertex2.VecSub(vertex0);
- Vector3D EyeVector =
- vertex0.VecSub(camera.GetPos());
When I debug the program I am getting this errors
Screenshot_215.jpg
The declaration of 'Vertex'
Expand|Select|Wrap|Line Numbers
- Vertex(float x, float y, float z, float w);
And the declaration of 'Vertex3D
Expand|Select|Wrap|Line Numbers
- Vector3D(float x, float y, float z);