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.

Propose isParallel as new module

See original GitHub issue

Propose @turf/boolean-parallel module

To complement the boolean themed modules, this would only input (Multi)LineString geometry types and should be able to detect if the two inputs are parallel or not.

The majority of the code is already built in @turf/line-offset in isParallel() which was inspired by node-intersection.

The only trick with this module would be to support LineString inputs with more than 2 vertices, @turf/line-segment can help iterate over both inputs.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
stebogitcommented, Jun 14, 2017

@dpmcmlxxvi

For a segment using a constant distance seems like the easiest to implement using the available turf functions. I try to avoid angles and bearings if I can get away with distances.

What function would you use to calculate the distance? I can’t think of one Why would you avoid angles, what kind of issues do you think might arise?

Additional thought, would two parallel rhumb-lines have always the same (rhumb, I guess) distance?

480px-loxodrome svg

What about Great-Circle lines? Maybe these can’t be parallel…?

Would it be sequential segments that are parallel?

I’d say yes.

Does each sequential pair have to be of the same length?

To me this seems to be maybe too restrictive; two multi-segment LineString would be parallel only in case of a translation, as you pointed out. At this point comparing just the bearings makes it very convenient in my opinion.

For MultiLineString …

I would leave to the user how to define how to compare complex geometries; I feel like it would be kind of a guessing and most of the time a waist of resources in trying a lot of different combinations. However we can implement this part at any later time if necessary.

1reaction
dpmcmlxxvicommented, Jun 12, 2017

I’d recommend working up a definition for “parallel” for the various cases first:

  • For a segment using a constant distance seems like the easiest to implement using the available turf functions. I try to avoid angles and bearings if I can get away with distances.
  • For a LineString it’s a little vague how the parallel postulate would be applied. Would it be sequential segments that are parallel? Does each sequential pair have to be of the same length? If they do, are you really looking for an equal geometry that has just been shifted?
  • For MultiLineString you could define parallel as being that every LineString in MultiLineString #1 has a unique LineString in MultiLineString #2 to which it is parallel, and vice versa.

Lots of things to think through. Would be interesting to see if there is an agreed upon definition for these types of geometries out there.

Read more comments on GitHub >

github_iconTop Results From Across the Web

A new meta-module design for efficient reconfiguration of ...
Abstract. We propose a new meta-module design for two important classes of modular robots. The new meta-modules are three-dimensional, robust ...
Read more >
Module 24 Flashcards - Quizlet
What is parallel processing? The processing of many aspects of a problem simultaneously; the brain's natural mode of information processing for many ...
Read more >
Parallel running - Wikipedia
Parallel running is a strategy for system changeover where a new system slowly assumes the roles of the older system while both systems...
Read more >
CSS Flexible Box Layout Module Level 1 - W3C
This module introduces a new layout mode, flex layout , which is designed for laying out more complex applications and webpages.
Read more >
Development of Variable Viscoelastic Joint Module ... - MDPI
Versatility: New robotic systems can be quickly built, or new functionalities can be enabled by connecting a few identical or similar modules in...
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