zeffii / mesh_tiny_cad

a tiny set of unmissable CAD functions ( VTX, XALL ...) for Blender

Home Page:http://zeffii.github.io/mesh_tiny_cad/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

What does V2X do when edges do not intersect but cross in 3d space?

pjlorca opened this issue · comments

Thanks for this absolutely essential addon in Blender! I cannot understand what V2X does when trying to find the intersection between two edges that actually do not intercept because they cross in 3d space (not when parallel).
For example:

  • first edge: (0, 0, 0) and (0, 0, 1)
  • second edge: (1, 0, 0) and (1, 1, 0)
    V2X creates a vertex at (0.5, 0, 0). Why?
    Thank you very much!

you mean they optically intersect from an arbitrary vantage point? right now i think it does nothing, it has a tolerance test, lines must intersect within this value (tolerance) else the v2x should reject the operation, and return control to you.

Yes, I mean they do not share any common points, like in the example I gave (those two segments are perpendicular to each other, but do not intersect at any point). Right now, the addon creates a vertex at (0.5, 0, 0) (global coordinates), no matter the view point.
I attach a very simple blend file with the above example.
Thanks!
V2X ERROR.zip

oh it does?

    iv = geometry.intersect_line_line(v1, v2, v3, v4)

    if iv:
        iv = (iv[0] + iv[1]) / 2
        bme.verts.new(iv)

which works "nicely" when the two lines form a comon plane, but yeah parallel lines or optically intersecting are not specifically handled (unlike in VTX which i recall does handle parallel lines explicitly ).

https://github.com/zeffii/mesh_tiny_cad/blob/master/V2X.py

this is a perfect opportunity for you to read the code and attempt to modify it yourself so that it does what you want.

V2X creates a vertex at (0.5, 0, 0). Why?

because the algorithm returns the closest points on both lines.