Question: I am having trouble understanding how to solve this question, if anybody is willing to give me step by step or help me with this

I am having trouble understanding how to solve this question, if anybody is willing to give me step by step or help me with this I would appreciate it. Thank you!

a) Create an array "allVectors" with 10 Vector2 objects (initialize them to random points between 0 and 1).

b) Add a member function/method "NearestVector" to Vector2 for finding the nearest among a list of vectors:

Vector2 a(3,4);

b = a.NearestVector(allVectors);

Note 1: (Mathematically speaking) assume the vectors start from origin, then each vector represents a point.

Note 2: Use the Pythagorian the distance between two vectors (points).

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!