public Point GetPoint(Vector3 pos)
    {
        List <Voxel_DEPRECATED> local = new List <Voxel_DEPRECATED>();

        foreach (Voxel_DEPRECATED v in voxels)
        {
            if (v.IsPointInside(pos))
            {
                local.Add(v);
                break;
            }
        }
        if (local.Count == 0)
        {
            throw new Exception("Point is outside of known boundary!");
        }

        foreach (Voxel_DEPRECATED v in voxels)
        {
            if (!v.Equals(local[0]) && v.IsNeighbor(local[0].boundary))
            {
                local.Add(v);
            }
        }

        Point p = Interpolator_DEPRECATED.IWDInterpolatePoint(pos, local, voxelSize);

        return(p);
    }
Пример #2
0
    public double Calculate(InputDataSet_DEPRECATED ds, double dt)
    {
        for (int i = 0; i < points.Count; i++)
        {
            if (points[i] != null)
            {
                System.Numerics.Vector3 newPos = new System.Numerics.Vector3();
                newPos.X = points[i].Pos.X + points[i].Vel.Y * (float)dt;
                newPos.Y = points[i].Pos.Y + points[i].Vel.X * (float)dt;
                newPos.Z = points[i].Pos.Z + points[i].Vel.Z * (float)dt;
                try
                {
                    points[i] = Interpolator_DEPRECATED.IWDInterpolatePoint(newPos, ds.GetPoints(), ds.voxelSize);
                }
                catch (Exception)
                {
                    points[i] = null;
                }
            }
            if (points[i] == null)
            {
                //Console.WriteLine("[WARNING] point " + i + " in null");
            }
        }
        double A, B, C, D;

        if (points[1] == null || points[2] == null)
        {
            B = 0;
            D = 0;
        }
        else
        {
            B = (points[1].Pos.X - points[2].Pos.X) / 2 * radius;
            D = (points[1].Pos.Y - points[2].Pos.Y) / 2 * radius;
        }
        if (points[3] == null || points[4] == null)
        {
            A = 0;
            C = 0;
        }
        else
        {
            A = (points[4].Pos.X - points[3].Pos.X) / 2 * radius;
            C = (points[4].Pos.Y - points[3].Pos.Y) / 2 * radius;
        }

        double[,] phi = new double[2, 2] {
            { A, B }, { C, D }
        };

        double[,] phiT    = Matrix.Transpose(phi);
        double[,] phiTphi = Matrix.Dot(phiT, phi);
        EigenvalueDecomposition eig = new EigenvalueDecomposition(phiTphi, true, true);

        double[] eigh = eig.RealEigenvalues;
        return(Matrix.Max(eigh));
    }
 public Point GetPoint(Vector3 pos, bool simple)
 {
     if (simple)
     {
         return(Interpolator_DEPRECATED.IWDInterpolatePoint(pos, GetPoints(), voxelSize));
     }
     else
     {
         return(GetPoint(pos));
     }
 }
    private void CalculatePoint(object cell_pos_seeds)
    {
        List <object> param = (List <object>)cell_pos_seeds;

        int[]    cell = (int[])param[0];
        double[] pos  = (double[])param[1];
        List <Seed_DEPRECATED> seeds = (List <Seed_DEPRECATED>)param[2];

        double FTLE = Interpolator_DEPRECATED.IWDInterpolateFTLE(pos, seeds, 0.5);

        lock (fieldlock)
        {
            field[cell[0], cell[1]] = FTLE;
        }
        notifier.Set();
    }