lineIntersectsLine is not commutative
See original GitHub issueHi,
I noticed this:
const line1 = [
[50.054358, 8.693184],
[50.055604, 8.685873]
];
const line2 = [
[50.054228, 8.69338],
[50.054358, 8.693184]
];
lineIntersectsLine(line1, line2);
// false
lineIntersectsLine(line2, line1);
// true
Note that the start of line1 and the end of line2 are identical.
What do you think is the expected result? Since the lines share a point, they arguably do intersect. However my use case is around multiple lines fanning out from a single point and I don’t want to count those as intersecting.
I’d suggest adding a parameter excludeEndpoints that determines wether sharing a start/end-point should count as intersecting. What do you think?
I can probably open a PR if we decide on something.
Kind regards, yeldiRium
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
intuition for matrix multiplication not being commutative
I like to simply not have intuition on this, and take for granted that in general, composition of functions will not be commutative...
Read more >GABLE: A Matlab Tutorial for Geometric Algebra
This tutorial is not a tutorial on Matlab, and to work more easily with it ... The sign-change in the exponent is due...
Read more >A Book of Abstract Algebra - UMD Math
is not commutative. EXERCISES. A. Examples of Abelian Groups. Prove that each of the following sets, with the indicated operation, is an abelian...
Read more >GRADE 5 • MODULE 6
They not only reach back to recall learning from the very beginning of Grade 5, ... T: Line intersects line . ... commutative...
Read more >Multiplication of Matrices is Not Commutative - YouTube
Register for FREE at http://deltastep.com or download our mobile app: https://bit.ly/3akrBoz to get all learning resources as per ICSE, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Thanks @yannbriancon. I’ve merged your PR.
@HarryStevens Thanks for this great library!
I am though having issues with the fact that if the end point of one line is on the other line but is not its beginning or end, the lines are not detected as intersecting.
Here is an example: line1 = [a, b] = [[0, 0], [1, 0]] line2 = [c, d] = [[0.5, -1], [0.5, 0]]
Here is a PR fixing the issue https://github.com/HarryStevens/geometric/pull/23 but reach out if you have another fix in mind