
CHAPTER 5 ■ GETTING THE MOST OUT OF VERTICES
511
private List<Vector3> InterpolateCR(Vector3 v1, Vector3 v2, Vector3 v3, Vector3 v4)
{
List<Vector3> list = new List<Vector3>();
int detail = 20;
for (int i = 0; i < detail; i++)
{
Vector3 newPoint = CR3D(v1, v2, v3, v4, (float)i / (float)detail);
list.Add(newPoint);
}
list.Add(v3);
return list;
}
5-17. Create the Vertices for a Racing Track
The Problem
Givena list of base points in 3D space, you want to create a racing track that goes through all
ofthesepoints.Youwanttocreatethevertices,calculatethenormals,andputatextureover
the track automatically.
The Solution
Youcancreatearacingtrackfromalistof3Dpointsinafewsteps,asshowninFigure5-33. ...