In these statements VVertexA and V are arrays of doubles and x and z are float members of the mapVertex class of which vertexList is a list.
vertexList = new List<mapVertex>();
for (...)
vertexList.Add( new mapVertex( (float) V[0], (float) V[1] ) );
Here is the Find statement. After execution of the below however newEdge.A is equal to null.
newEdge.A = vertexList.Find( x => (x.x == (float) VE.VVertexA[0]) && (x.z == (float) VE.VVertexA[1]) );
The below evaluates to true in the expression evaluator in MonoDevelop when I breakpoint on the line in question and the debugger confirms the values look correct, so I'm not sure why List.Find() isn't returning the first element of vertexList.
(vertexList[0].x == (float) VE.VVertexA[0]) && (vertexList[0].z == (float) VE.VVertexA[1])
Is this possibly related to a type conversion issue? The values of the items in vertexList were originally created by casting double to float (see above), but from what I understand doubles should be deterministic when casting to float.
Aucun commentaire:
Enregistrer un commentaire