u1234x1234 / pynanoflann

Unofficial python wrapper to the nanoflann k-d tree
BSD 2-Clause "Simplified" License
34 stars 8 forks source link

.AddPoint() function? #13

Open andrearlotta opened 5 months ago

andrearlotta commented 5 months ago

Hey there, wondering if there's a way to append elements without refitting every time the dataset. Thanks!

 /**
     * Called during search to add an element matching the criteria.
     * @return true if the search should be continued, false if the results are
     * sufficient
     */
    bool addPoint(DistanceType dist, IndexType index)
    {
        printf(
            "addPoint() called: dist=%f index=%u\n", dist,
            static_cast<unsigned int>(index));

        if (dist < radius) m_indices_dists.emplace_back(index, dist);
        return true;
    }

    DistanceType worstDist() const { return radius; }
};