mrdoob/three.js — pull request #4441 by tsherif (2014-02-14 22:26:23+00:00)
Title: Return already calculated vertex and index information when raycasting on BufferGeometry

I noticed that when THREE.Raycaster is working on THREE.BufferGeometry, it calculates useful information about the vertices in the mesh that it's checking against and the indices of those vertices in the position array, but then simply throws that information away. I basically just made it so this information is added to the **intersection** object that's returned in properties called **vertices** and **indices**.

As an example of an application in which this would be hugely useful (shift-click to select a point): https://brainbrowser.cbrain.mcgill.ca/macacc-viewer

The application essentially lets the user select a vertex from the mesh, then looks up a color map based on the vertex that was selected. What I have to do now is get the intersection point from the raycaster and then search through the vertices of the model for the closest vertex. If the information was already returned, I could just check against the vertices of the intersected face.

I checked both the BufferGeometry and Raycaster examples and everything seems to work fine.