Пример #1
0
        public FTLEField(InputDataSet ids, int resolution)
        {
            Vector3 min = new Vector3(float.PositiveInfinity);
            Vector3 max = new Vector3(float.NegativeInfinity);

            foreach (Voxel <Point> v in ids.Voxels)
            {
                if (v.vertices[3].X < min.X)
                {
                    min.X = v.vertices[3].X;
                }
                if (v.vertices[3].Y < min.Y)
                {
                    min.Y = v.vertices[3].Y;
                }
                if (v.vertices[3].Z < min.Z)
                {
                    min.Z = v.vertices[3].Z;
                }

                if (v.vertices[4].X > max.X)
                {
                    max.X = v.vertices[4].X;
                }
                if (v.vertices[4].Y > max.Y)
                {
                    max.Y = v.vertices[4].Y;
                }
                if (v.vertices[4].Z > max.Z)
                {
                    max.Z = v.vertices[4].Z;
                }

                voxels.Add(new OrderedVoxel <SeedPoint>(v.vertices, resolution));
            }
            float   size       = (float)voxels.First().GetVoxelDimension();
            Vector3 matrixSize = Vector3.Divide(Vector3.Subtract(max, min), size);

            voxelsMatrix = new OrderedVoxel <SeedPoint> [(int)matrixSize.X, (int)matrixSize.Y, (int)matrixSize.Z];
            foreach (OrderedVoxel <SeedPoint> v in voxels)
            {
                int x = (int)Math.Round((v.vertices[3].X - min.X) / size);
                int y = (int)Math.Round((v.vertices[3].Y - min.Y) / size);
                int z = (int)Math.Round((v.vertices[3].Z - min.Z) / size);
                voxelsMatrix[x, y, z] = v;
            }
            Debug.WriteLine("Min " + min + " Max " + max);
            squares = new List <Square <SeedPoint> >();
        }
Пример #2
0
 public Advection(InputDataSet ids, StreamLines sls)
 {
     IDS = ids;
     SLS = sls;
 }