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.
2 Answers
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°$.
-
-
1$\begingroup$ I never knew Equal did that ! .. that's half-a-xillion Dot-Products I'll never get back... :) $\endgroup$– Robin Betts ♦Commented May 3, 2023 at 20:02
-
$\begingroup$ @RobinBetts :D ...This comment made my day. For others: it's a
Compare
node set to Vector $\endgroup$– quellenform ♦Commented May 3, 2023 at 20:18
-
-
$\begingroup$ Wow, i dont really know what it will do but i have an assumption. You can create many vertices on one line and the angle defines the visibility? That would be my 2nd question, because i tried and failed. But i am failing also on this here. Please take a look on this pic. Must be exact the same like yours... i.sstatic.net/vsBbq.png and i.sstatic.net/M5rl4.png BTW: something happend to my account, have a new one, i $\endgroup$– ProbberCommented May 3, 2023 at 18:46
-
$\begingroup$ @Probber perhaps the extrusion has an inconsistent direction, I don't think it's reasonable to work on this answer, as I said it's just for fun :D $\endgroup$ Commented May 4, 2023 at 13:52