I have a mesh, in which every vertex has most likely 6 to 8 neighbours. I need to compute like on the picture. For vertex O there are three incoming vertices: A, B and C. And we have these paths: AC, BA, CA. The criterium to choose path - it must be as close to a straight line as possible, so AOC is better then AOB.
I have coordinates $(x, y, z)$ for every vertex. For now i think i need to compute dot products of all pairs: OA, OB, OC and then choose best paths. Is there any possible optimization. E.g. somehow compute only dot products $ OA \cdot OC$ and $ OA \cdot OB$ and deduce right paths from this data?

Thanks.