Forum

Calculating distance between multiple points and displaying them in VL

Hi,

I am trying to get the distance between each and every center point of the circles present.
I have kinda managed to do this but it requires the openCV renderer to be placed inside the second ForLoop. Which displays the results in 5 separate renderers (I want to do it in one). I noticed there is a group(spectral) node to combine the spread in skia renderer but is there a similar node for openCV renderer? Or should I change my approach to get the same result?


PointDistance.vl (26.8 KB)

It is recommended to do the visualization in Skia or Stride, the OpenCV window is rather for debugging and displaying intermediate results, not for complex info graphics.

1 Like

I see, my application will require openCV as I would be using the circle detector function (HoughCircles). Is there a way to convert from openCV to skia for the visualization part?
Or better yet, if I can somehow use the accumulator in the ForEach Loop to update the index once the distance from one point to the other is done (as currently if I do this it would only return the distance from point one(index one) to all the other points and not the index from other points between each other).

You have to do switch or if statement inside loop and compare previous with current and write to accumulator only result

Sorry, I don’t understand what I should put in the if statement… to write the result.
I tried connecting the spread into the result accumulator this gives me this as it is now shifting the index for the distance calculation.


I can’t seem to think of a solution without a second for loop to get the distance of all points…

yes, if you want to have all distances between all points, you will need two loops. but they only need to run over the less than half the spread, since you don’t need to compare A->B and B->A and also not A->A and B->B…

1 Like