Open Kevin-Mattheus-Moerman opened 8 months ago
For the first goal, you should be able to compute pairwise(Euclidean(), V1, V2)
. It will treat V1
and V2
as iterables and compute exactly what you need.
For the second goal, there's NearestNeighbors.jl
. The good thing is that your type should have length(GeometryBasics.Point{3, Float64}) == 3
(already built in) as requested by that package, so you should be able to create a tree out of V1
directly, and then request the single nearest neighbors for V2
.
If you encounter difficulties, perhaps consider posting to the Julia discourse. If everything works just fine, please consider closing this issue.
I'm relatively new to Julia but started working a lot with GeometryBasics entities, such as their 3D point types. Here is an example to create a hand full:
I had created my own distance function where I used something like
norm(V1[i]-V2[j])
but have just updated my codes to useeuclidean(V1[i],V2[j])
instead which seems more efficient. So far I have these two functions:I was wondering if there is an even better way of doing the above for my application by using your package more optimally? My
dist
function creates an $n \times m$ array for a set of $n$ points compared to a set of $m$ points. The second function,mindist
creates an $n \times 1$ array where only the lowest distance (and its index if requested) to the set of $m$ points is stored.Thanks for any suggestions.