2
$\begingroup$

I feel this should be fairly straightforward, but I am struggling a bit.

Basically, I want to find out if a point has a point after it on a single axis.

For example, if four points are in a line on the X axis, Each point should return "True" except the final point.

I feel Geometry Proximity would work, but I cannot figure out how to use it to compare a point with the index of 1 to a point of an index of 2 procedurally. (working with a few thousand points).

Here is an example using code if that helps me make any more sense. Here I have a threshold value of 5, so basically if the position of the next point was more than 5 units away, it would return as false.


int currentPtNum = @ptnum
int neighborPtNum = currentPtNum + 1

if (point(0, "P", neighborPtNum).x - point(0, "P", currentPtNum).x <= 5.0) {
    @value = 1
}

else {
    @value = 0
}

My idea was to take the position of point 2 and subtract point 1 from it. But I cannot seem to be able to do that. Hopefully you fine folk may know of a way.

$\endgroup$
2
  • 1
    $\begingroup$ What about using an Attribute Statistics node to get the largest value of X (for example), then a Capture Attribute node to tag points with a boolean based on the difference between point X and X_max if it is below a threshold ? $\endgroup$ Apr 22 at 11:54
  • $\begingroup$ Hello and welcome Scouty, you may be inspired by this tutorial: youtube.com/watch?v=tj6ZZYO5qPY $\endgroup$
    – Fred I. R.
    Apr 22 at 12:14

1 Answer 1

5
$\begingroup$

The Dot-Product of two vectors a and b is the signed length of the projection of a onto b, (times the length of b,) so for positions with a common origin, can be used as a comparative measure of 'how far along' the axis b the point a lies:

enter image description here

.. above, compared with the maximum such value. The 'Vector' input is any vector in the direction along which you want the comparison to be made. All points other than the maximum in that direction will evaluate True.

enter image description here

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .