Conditional

Hello, hope somebody can help.

I have two points and i compare the distance between them so I get a True or a False value, Well I would like to draw a circle in red or in green depending if it was a true or a false, beleve me that i am traying but do not know how to make the condition. Thanks a lot

just use list item for 0th and 1st as boolean value:
Here I am just comparing distance by closest point

2 Likes

Hello, sorry for the delay, i do not understand how it works. Why N=2 in the closest point item? Thanks!!!

Because the first closest point in the cloud is the point itself. So you need to find the next closest point.
This is because the Closest Point component doesn’t assume that the input points are the same coordinates as the output points.

You could use the Proximity3D component instead, it solves closest-neighbour-pairs within a single cloud, but it has other complications you’d have to deal with.

so the definition is coloring circles in blue those that have another circle closer than 2.4?
Thanks

Yes, it is a way of assigning color values to book flags.

i am trying to do it with a cross reference instead of grafting and i do not get it, do not know why
circles.gh (7.7 KB)

The way it works in code

  1. take 1st point and measure distance between each point in a list
  2. sort those points by distance value
  3. when sorting first closest distance is zero because there is point itself in that list, so you take second
  4. repeat the this procedure for the rest of points:
    2nd point search in full collection of points
    3rd point search in full collection of points
    4th point search in full collection of points

And so on…

I do not know why you would like to use cross reference.
Because you just need to search closest point per each point with full collection of points n times when n is a list length of all points

So the data tree looks like this
1st branch
1st point
2nd branch
2nd point

N branch
N point

And second data tree
1st branch
All points
2nd branch
All points

N branch
All points

You do not notice that all points are n times duplicated, but inside component the whole procedure is rerun n times