sverchok
sverchok copied to clipboard
"Analyzer->Circle Intersection" unexpected result?
Windows 11, Blender 3.3.1, Sverchok master.
http://nortikin.github.io/sverchok/docs/nodes/analyzer/intersect_circle_circle.html
I visualize context of node "Analyzer->Circle Intersection" when Intersection Plane defined by Normal. If parameters are simple then result is good and expectable:
But if I set "Normal" input in direction when it is not normal to Line AB then I got wrong result:
I found than this appears in cases if "Normal" input is not normal to line OriginA-OriginB.
If I align it to normal of Line OriginA-OriginB with additional nodes then result is good:
Is protection of Normal parameter is solution for this case or I do some thing wrong?
P.S.
You can test it with:
https://gist.github.com/satabol/667a036e484d04102e35d2f5e6dfad5d#file-analizer-circle-circle-intersection-json
Code node:
https://github.com/nortikin/sverchok/blob/45beb7aee659a141b15842cdd74bab00fb5dd483/nodes/analyzer/intersect_circle_circle.py#L28-L84
I guess that non perpendicular normal to the line AB is invalid input. The solution could be to project an invalid normal to perpendicular surface.
There is a lot of such API (project something to something etc) in utils/geom.py.
I guess it can be done simple as that
perpendicular = cross_product(wrong_normal, line_direction)
fixed_normal = cross_product(perpendicular, line_direction)
I'm not sure about the order of the arguments.
Thank you @portnov and @Durman. I have an idea about this node output sockets for that case (may be current node sockets output is insufficient). Is it sense to add next items:
- Result normal that node use (@Durman's suggestion)
- Matrix for Center A
- Matrix for Center B
- Matrix for line Intersection AB (Normal to line origin AB)
?
(template)
This allow user to continue build his node map on results of this node "Circle Intersection"
I don't think it would be wise to add sockets which are irrelevant to the function of the node. If the node is named Intersection then it should return intersections. Matrix intersection could be added but it looks redundant because it can be easily constructed from intersection points if someone has such need.
@Durman Yes, you right. But this node is not simple. The name of node says about intersection of circles (and ask about normal? Why?) but in background it use intersection of spheres and a plane. I was embarrassed when I try to use Z axis and got strange result that I cant explain. I think the name of this node describe it functionality partially. But rename of node is bad. But this is just idea.