//initializes the List Vector3 wholeMalla, nextStart, and zLot by ref //in this class initializes the fields,StepX , StepZ, Columns, Rows public void InitializeMallaStats(Vector3[] vertices, ref List <Vector3> wholeMalla, ref Vector3 nextStart, ref float zLot) { if (StepX != 0) { return; } if (vertices == null) { return; } wholeMalla = UPoly.ReturnWholeMallaAs1Poly(Program.gameScene.controllerMain.MeshController.Vertices); nextStart = wholeMalla[0]; zLot = wholeMalla[0].z; //UVisHelp.CreateHelpers(wholeMalla[0], Root.redSphereHelp); //UVisHelp.CreateHelpers(wholeMalla[2], Root.redSphereHelp); _lenght = wholeMalla[0].x - wholeMalla[1].x; _height = wholeMalla[3].z - wholeMalla[0].z; _mathCenter = m.Vertex.BuildVertexWithXandZ((wholeMalla[0].x + wholeMalla[1].x) / 2, (wholeMalla[3].z + wholeMalla[0].z) / 2); float epsi = 0.001f; for (int i = 0; i < vertices.Length; i++) { bool eq = UMath.nearlyEqual(vertices[i].x, wholeMalla[0].x, epsi); if (eq) { Columns++; } eq = UMath.nearlyEqual(vertices[i].z, wholeMalla[0].z, epsi); if (eq) { Rows++; } } StepX = _lenght / Columns; StepZ = _height / Rows; //print("Columns:" + Columns); //print("Rows:" + Rows); }