Javascript - Convert arc polyline to arrow polygon

المشرف العام

Administrator
طاقم الإدارة
I am using the arc.js library to generate arcs on my map. Those arcs are polylines. I would like to transform those arcs into arrows polygon.

To create the arc, I need the start and the end coordinates.

var start = { x: -122, y: 48 };var end = { x: -77, y: 39 };var generator = new GreatCircle(start, end);var line = generator.Arc(50, {offset:5});The result is an array of 50 coordinates.

My idea to create the arrow polygon is to offset the start and end points to create a second parallel arc, and then, combine the two arrays of coordinates into one polygon ring.

However, the challenge is to define the orientation of the offset for the second arc.

If I have the starting and ending coordinates, how can I define two other points in order to create a parallel arc?



أكثر...
 
أعلى