Exemplo n.º 1
0
        private void PopulateVoxel(object voxel_notifier_resolution)
        {
            List <object>            param    = (List <object>)voxel_notifier_resolution;
            OrderedVoxel <SeedPoint> voxel    = (OrderedVoxel <SeedPoint>)param[0];
            ManualResetEvent         notifier = (ManualResetEvent)param[1];
            int    resolution = (int)param[2];
            double diameter   = voxel.GetVoxelDimension();
            float  step       = (float)(diameter / resolution);

            for (int x = 0; x < resolution; x++)
            {
                for (int y = 0; y < resolution; y++)
                {
                    semaphore.WaitOne();
                    for (int z = 0; z < resolution; z++)
                    {
                        Vector3 pos = new Vector3((x * step) + voxel.vertices[3].X,
                                                  (y * step) + voxel.vertices[3].Y,
                                                  (z * step) + voxel.vertices[3].Z);
                        SeedPoint sp = Interpolator <SeedPoint> .IWDInterpolatePoint(pos, bulkList, diameter);

                        if (sp == null)
                        {
                            sp = Interpolator <SeedPoint> .NNInterpolatePoint(pos, bulkList);
                        }
                        voxel.AddPoint(sp);
                        voxel.AddPointAt(sp, x, y, z);
                    }
                    semaphore.Release();
                }
            }
            notifier.Set();
        }
Exemplo n.º 2
0
 public Point GetPoint(Vector3 pos)
 {
     return(Interpolator <Point> .IWDInterpolatePoint(pos, Interpolator <Point> .SelectVoxels(pos, Voxels), voxelSize));
 }