sverchok icon indicating copy to clipboard operation
sverchok copied to clipboard

"Analyzer->Circle Intersection" unexpected result?

Open satabol opened this issue 2 years ago • 6 comments

Windows 11, Blender 3.3.1, Sverchok master.

image

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:

image

But if I set "Normal" input in direction when it is not normal to Line AB then I got wrong result:

image

I found than this appears in cases if "Normal" input is not normal to line OriginA-OriginB.

Intersection Circle-Circle Error

If I align it to normal of Line OriginA-OriginB with additional nodes then result is good:

Intersection Circle-Circle Error 003 gif

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

satabol avatar Oct 15 '22 18:10 satabol

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.

Durman avatar Oct 17 '22 04:10 Durman

There is a lot of such API (project something to something etc) in utils/geom.py.

portnov avatar Oct 17 '22 04:10 portnov

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.

Durman avatar Oct 17 '22 04:10 Durman

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:

  1. Result normal that node use (@Durman's suggestion)
  2. Matrix for Center A
  3. Matrix for Center B
  4. Matrix for line Intersection AB (Normal to line origin AB)

?

image (template)

This allow user to continue build his node map on results of this node "Circle Intersection"

satabol avatar Oct 17 '22 14:10 satabol

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 avatar Oct 18 '22 04:10 Durman

@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.

satabol avatar Oct 18 '22 06:10 satabol