Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A code for the intersection point of 2 line segments #99

Open
vvoovv opened this issue May 16, 2024 · 4 comments
Open

A code for the intersection point of 2 line segments #99

vvoovv opened this issue May 16, 2024 · 4 comments

Comments

@vvoovv
Copy link
Member

vvoovv commented May 16, 2024

I am starting to implement intersections with Geometry Nodes. For that I will need to find an intersection point of 2 line segments.

Where can I find the code for that in the existing code base of the addon?

@polarkernel
Copy link
Collaborator

Where can I find the code for that in the existing code base of the addon?

For instance, the function _isectSegSeg() does that, see line 116 in lib/CompGeom/BoolPolyOps.py.

@vvoovv
Copy link
Member Author

vvoovv commented Jun 25, 2024

There is a condition in the function _isectSegSeg()

if 0. < t1 < 1. and 0. < t2 < 1:

Why doesn't it include 0 and 1?

@vvoovv
Copy link
Member Author

vvoovv commented Jun 25, 2024

In other words, why doesn't it have the form

if 0. <= t1 <= 1. and 0. <= t2 <= 1:

?

@polarkernel
Copy link
Collaborator

In other words, why doesn't it have the form if 0. <= t1 <= 1. and 0. <= t2 <= 1: ?

_isectSegSeg() is used by the function 'boolPolyOp()', which finds unions, intersections and differences of polygons. It finds the intersection points of the polygons. The endpoints of the polygon segments are already processed as IN, ON or OUT of the partner polygon, before these intersections are calculated. Since these endpoints are already known, they must be excluded by _isectSegSeg(), so that they are not duplicated. Therefore, 0 and 1 are excluded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants