planar-graph-to-polyline

WebJar for planar-graph-to-polyline

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

planar-graph-to-polyline
Last Version

Last Version

1.0.5
Release Date

Release Date

Type

Type

jar
Description

Description

planar-graph-to-polyline
WebJar for planar-graph-to-polyline
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/mikolalysenko/planar-graph-to-polyline

Download planar-graph-to-polyline

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/planar-graph-to-polyline/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>planar-graph-to-polyline</artifactId>
    <version>1.0.5</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/planar-graph-to-polyline/
implementation 'org.webjars.npm:planar-graph-to-polyline:1.0.5'
// https://jarcasting.com/artifacts/org.webjars.npm/planar-graph-to-polyline/
implementation ("org.webjars.npm:planar-graph-to-polyline:1.0.5")
'org.webjars.npm:planar-graph-to-polyline:jar:1.0.5'
<dependency org="org.webjars.npm" name="planar-graph-to-polyline" rev="1.0.5">
  <artifact name="planar-graph-to-polyline" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='planar-graph-to-polyline', version='1.0.5')
)
libraryDependencies += "org.webjars.npm" % "planar-graph-to-polyline" % "1.0.5"
[org.webjars.npm/planar-graph-to-polyline "1.0.5"]

Dependencies

compile (7)

Group / Artifact Type Version
org.webjars.npm : robust-orientation jar [1.0.1,2)
org.webjars.npm : edges-to-adjacency-list jar [1.0.0,2)
org.webjars.npm : planar-dual jar [1.0.0,2)
org.webjars.npm : two-product jar [1.0.0,2)
org.webjars.npm : uniq jar [1.0.0,2)
org.webjars.npm : point-in-big-polygon jar [2.0.0,3)
org.webjars.npm : robust-sum jar [1.0.0,2)

Project Modules

There are no modules declared in this project.

planar-graph-to-polyline

Converts a planar graph to a collection of nested polylines (as would be consumed in a GeoJSON/TopoJSON file for example).

Example

var graphToPolygons = require("planar-graph-to-polyline")

var edges = []
var positions = []

for(var i=1; i<=3; ++i) {
  var v0 = positions.length
  for(var j=0; j<10; ++j) {
    var theta = 2.0 * Math.PI * j / 10
    positions.push([ i * Math.cos(theta), i * Math.sin(theta) ])
    edges.push([ v0+j, v0+((j+1)%10) ])
  }
}

console.log(graphToPolygons(edges, positions))

Output:

[ [ [ 20, 29, 28, 27, 26, 25, 24, 23, 22, 21 ],
    [ 11, 12, 13, 14, 15, 16, 17, 18, 19, 10 ] ],
  [ [ 0, 9, 8, 7, 6, 5, 4, 3, 2, 1 ] ] ]

Install

npm install planar-graph-to-polyline

API

require("planar-graph-to-polyline")(edges, positions)

Converts a planar graph into a collection of nested polylines

  • edges are the edges of the graph
  • positions are the locations of the vertices in the plane

Returns A list of loops encoding the regions bounded by the graph

Credits

(c) 2014 Mikola Lysenko. MIT License

Versions

Version
1.0.5