# The Array Enigma 101

## Recommended Posts

So for the last view weeks I've been learning vex, great stuff. So now I want to turn my new awesome vex knowledge into practise.
The goal of this operation is the measure the distance between each point to their closest neighbour.

First, I use the pcfind function to grab the nearest point of each point number and put them in an array.

Second, now I like to grab the values from the array and put them into a distance function. (BUT HOW?)

I find array a bit of a vague concept. I get its a list of values, but I'm not really sure if the point numbers in the array also hold the position vector.
Not sure if I'm doing this right, and probably there better way.  If this method is right, pretty please help me out.

kind regards,

The new kid on the block

measure_distance_nearpoint.hip

##### Share on other sites

@distance = distance(@P, point(0, "P", @nearpt[1]));

this finds dist between current point being processed, @P, and its nearest neighbour....@nearpt[0] would be ITSELF...so we skip to @nearpt[1]

However, I'm puzzled why your statement

v@nearpt = pcfind(0, "P", @ptnum, 10.0, 2);

works tho ?...to me it should be v@nearpt = pcfind(0, "P", @P, 10.0, 2);

can someone explain ?

• 2

##### Share on other sites

Noobini, thank you for your help

## Create an account

Register a new account