CPSC310A
Video Game Development

Activity 14

Vector Operations

Details

Write a Vector class with the following methods:

  1. Vector(float x, float y, float z)

    Creates a new vector with the specified values.

  2. Vector subtract(Vector vector)

    Returns a new vector that is this vector minus the specified vector.

  3. static float dot(Vector vector, Vector vector)

    Returns the dot product of the two specified vectors.

  4. static Vector cross(Vector vector1, Vector vector2)

    Returns the cross product of the two specified vectors.

Submission

Please show your source code and run your program for the instructor.