コード例 #1
0
    void MakeAndFind1()
    {
        kd1 = new KDTreeStruct();
        kd1.MakeFromPoints(points_native);

        float rTot = 0;

        for (int i = 0; i < queries.Length; i++)
        {
            int id = kd1.FindNearest2(queries[i]);
            rTot = rTot + (queries[i] - points_native[id]).magnitude;
        }

        Debug.Log("Native array single threaded " + rTot);
    }
コード例 #2
0
    float NeighbourDistancesSumNative()
    {
        kdTreeNative = new KDTreeStruct();
        kdTreeNative.MakeFromPoints(pointsNative);

        float neighbourDistancesSum = 0f;

        for (int i = 0; i < queries.Length; i++)
        {
            int id = kdTreeNative.FindNearest(queries[i]);
            neighbourDistancesSum = neighbourDistancesSum + math.length(queries[i] - pointsNative[id]);
        }

        return(neighbourDistancesSum);
    }
コード例 #3
0
    void MakeAndFind2()
    {
        kd2 = new KDTreeStruct();
        kd2.MakeFromPoints(points_native);

        float rTot = 0;

        for (int i = 0; i < queries.Length; i++)
        {
            int    id       = kd2.FindNearest2(queries[i]);
            float3 relative = queries[i] - points_native[id];
            rTot = rTot + math.sqrt(math.dot(relative, relative));
        }

        Debug.Log("Native array jobified " + rTot);
    }