question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

is_line_line_colinear

See original GitHub issue

Feature Request

As a COMPAS user, I want compas.geometry.queries to have a function for lines co-linear check and so that we can all use it.

Details

Describe the solution you’d like I would like the following (or something similar) to happen:

line1 = Line([0, 0, 0], [1, 1, 1])
line2 = Line([2, 2, 2], [3, 3,3])
assert is_line_line_colinear(line1, line2) == true
"Another Direction should work too"
line3 = Line([-2,- 2, -2], [3, 3,3])
assert is_line_line_colinear(line1, line3) == true

Describe alternatives you’ve considered Currently there is a function to check if 3 points in colinear. https://github.com/compas-dev/compas/blob/16f3f6ef3b49a6a2191f41feb5da79d7bdac3f5c/src/compas/geometry/queries.py#L117

There is also feature to do intersection between 2 lines.
https://github.com/compas-dev/compas/blob/16f3f6ef3b49a6a2191f41feb5da79d7bdac3f5c/src/compas/geometry/queries.py#L792

But not a simple 2 lines colinear check, or did I miss something? Would be useful to have this feature.

similarly, is_line_line_overlap(l1, l2, epsilon) might also be useful

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
brgcodecommented, Oct 18, 2019

anyhow, since with this thread the colinear function is basically implemented, how about we go through the proper channels, which means you write a PR and i approve it 😃

0reactions
yck011522commented, Oct 18, 2019

Hi Tom, I haven’t got any experience creating a Pull Request. But I can give it a try. Please let me know if I do anything wrong.

Read more comments on GitHub >

github_iconTop Results From Across the Web

计算几何_直线求交点_线段判相交- 过路人1998 - 博客园
使用克拉默法则 Point GetLineLineIntersect(const Line &a, const Line &b) { Point pt = a.st; if (IsLineLineCollinear(a, b)) return pt; ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found