public void Sampling3D(TwoVariableFunction myFn, float x_min, float x_max, float z_min, float z_max, float offset0) { width = height = 0; minX = x_min; maxX = x_max; minZ = z_min; maxZ = z_max; offset = offset0; vertices = new List <Vector3>(); uVs = new List <Vector2>(); faces = new List <int>(); topLeft = new Vector3(maxX, myFn(maxX, minZ), minZ); topRight = new Vector3(maxX, myFn(maxX, maxZ), maxZ); bottomLeft = new Vector3(minX, myFn(minX, minZ), minZ); bottomRight = new Vector3(minX, myFn(minX, maxZ), maxZ); int total = 0; for (float i = minX; i <= maxX; i += offset) { for (float j = minZ; j <= maxZ; j += offset) { Vector3 point = new Vector3(i, myFn(i, j), j); vertices.Add(point); total++; } width++; } height = total / width; }
public static NetworkVector ApplyFunctionComponentWise(NetworkVector vector1, NetworkVector vector2, TwoVariableFunction fctn) { return(new NetworkVector(vector1._vector.Zip(vector2._vector, (x, y) => fctn(x, y)))); }