# Check if lines are collinear with Geometry Nodes

I want to check if two connected lines are collinear. If yes then I want to place at the middle point an object. To give the collinearity a little bit of tolerance $$±5°$$ would be a nice addition.

You can do this, for example, by comparing the direction vectors between the points, thus creating a selection.

Something like this:

Here I get the direction vectors of the edges with the node Edge Vertices, and compare them with the node Compare.

The epsilon of $$0.087$$ corresponds to an angle of $$5°$$ (The values are in radians!).

Additionally I use the node Compare to select a certain point.

Both selections together then result in the selection for the instantiation of the desired object at the desired point, as soon as the angle between the two lines is less than $$5°$$.

(Blender 3.2+)

• Wow works like a charme!! May 3, 2023 at 18:09
• I never knew Equal did that ! .. that's half-a-xillion Dot-Products I'll never get back... :) May 3, 2023 at 20:02
• @RobinBetts :D ...This comment made my day. For others: it's a Compare node set to Vector May 3, 2023 at 20:18