Finding closest point to a direction vector

559 Views Asked by At

I got an array of 3D points $(x, y, z)$ and a "Rotator" object (pitch yaw roll).

Assuming the Rotator location is in $(0, 0, 0)$ I'm looking to find the closest point to the direction my Rotator object.

I thought of doing that the following way:

First convert my Rotator to a normalized Vector3D, then find normalize each of the points to a Vector3D and then calculate the angle between each point and my Rotator Vector3D.

I'm not sure that is the correct way, but would like to get some help doing that. Thanks