private unsafe MeshVertex CreateVertex(CyCoord coords, float dTheta) { Vector3 *pos = stackalloc Vector3[3]; CyCoord tcoord = coords; for (int i = 0; i < 3; i++) { //compute 3 positions for computing the derivate respect theta pos[i] = tcoord.ToCartesian(); tcoord.Theta += dTheta; } var tangent = Vector3.Normalize(Numerics.DerivateForward1(pos, dTheta)); var normal = Vector3.Normalize(Vector3.Cross(tangent, new Vector3(0, -1, 0))); var texCoord = new Vector2(coords.Theta / Numerics.TwoPI, 0.5f - coords.Y / height); return(new MeshVertex(pos[0], normal, tangent, texCoord)); }