# How to get positions of points at regular intervals at a particular direction?

**URL:** <https://community.cesium.com/t/how-to-get-positions-of-points-at-regular-intervals-at-a-particular-direction/3453>\
**Category:** CesiumJS\
**Created:** [December 14, 2015, 12:06pm UTC](https://community.cesium.com/t/how-to-get-positions-of-points-at-regular-intervals-at-a-particular-direction/3453 "2015-12-14T12:06:26Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Parthesh](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/parthesh/32/6572_2.png) [@Parthesh](https://community.cesium.com/u/Parthesh)\
**Post date:** [December 14, 2015, 12:06pm UTC](https://community.cesium.com/t/how-to-get-positions-of-points-at-regular-intervals-at-a-particular-direction/3453/1 "2015-12-14T12:06:26Z")

</div>

I have demonstrated the issue in image below:

[![](https://lh3.googleusercontent.com/-V4_FJtI9Pvs/Vm6u1v8-BMI/AAAAAAAACjw/4IU5d7LlBxY/s400/question.png)](https://lh3.googleusercontent.com/-V4_FJtI9Pvs/Vm6u1v8-BMI/AAAAAAAACjw/4IU5d7LlBxY/s1600/question.png)

There are two known positions ‘A’ and ‘B’ and I would like to have the positions of all the points at regular intervals between them. How to do this in Cesium.

I know of one idea… I can find line equation between the two points and then by taking point A as origin taking 10m as radius, find intersection point between line and circle to get the point 10m away in desired direction from point A.

But that is a very inefficient way. I would like to know if there is any simpler and efficient way?

Thanks and Regards,

Parthesh.

---

<div class="post-metadata">

**Author:** ![Mark\_Erikson](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/mark_erikson/32/2024_2.png) [@Mark\_Erikson](https://community.cesium.com/u/Mark_Erikson)\
**Post date:** [December 14, 2015, 5:44pm UTC](https://community.cesium.com/t/how-to-get-positions-of-points-at-regular-intervals-at-a-particular-direction/3453/2 "2015-12-14T17:44:20Z")

</div>

It’s not a Cesium question, just a general geo calculation question. Basically, you need to determine the bearing from point A to point B, calculate the first intermediate position starting at A going at that bearing and your desired step distance, then repeat. There’s a great resource of geographic algorithms at [http://www.movable-type.co.uk/scripts/latlong.html](http://www.movable-type.co.uk/scripts/latlong.html) , including Javascript sample code. You’d be interested in the “bearingTo” and “destinationPoint” functions.

---

<div class="post-metadata">

**Author:** ![Kevin\_Ring](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/kevin_ring/32/2003_2.png) [@Kevin\_Ring](https://community.cesium.com/u/Kevin_Ring)\
**Post date:** [December 15, 2015, 12:08am UTC](https://community.cesium.com/t/how-to-get-positions-of-points-at-regular-intervals-at-a-particular-direction/3453/3 "2015-12-15T00:08:12Z")

</div>

Parthesh,

Take a look at EllipsoidGeodesic:

[https://cesiumjs.org/Cesium/Build/Documentation/EllipsoidGeodesic.html](https://cesiumjs.org/Cesium/Build/Documentation/EllipsoidGeodesic.html)

Kevin

---

<div class="post-metadata">

**Author:** ![Parthesh](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/parthesh/32/6572_2.png) [@Parthesh](https://community.cesium.com/u/Parthesh)\
**Post date:** [December 18, 2015, 4:06am UTC](https://community.cesium.com/t/how-to-get-positions-of-points-at-regular-intervals-at-a-particular-direction/3453/4 "2015-12-18T04:06:19Z")

</div>

Thanks Mark, the source is greatly helpful. But in this case I would prefer Kevin’s approach since Cesium itself is having a way to interpolate the points between the two given points. Although for general purposes(non-Cesium), the source is the best !

Thanks again,

Parthesh.

---

<div class="post-metadata">

**Author:** ![Parthesh](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/parthesh/32/6572_2.png) [@Parthesh](https://community.cesium.com/u/Parthesh)\
**Post date:** [December 18, 2015, 4:09am UTC](https://community.cesium.com/t/how-to-get-positions-of-points-at-regular-intervals-at-a-particular-direction/3453/5 "2015-12-18T04:09:44Z")

</div>

Thanks a lot Kevin, the method “interpolateUsingSurfaceDistance()” did the trick. I just have to pass the sampling distance as argument and put it in a for loop. Simple and efficient.

Thanks again,

Parthesh.

---

<div class="post-metadata">

**Author:** ![bhaskarr1205](https://avatars.discourse-cdn.com/v4/letter/b/bcef8e/32.png) [@bhaskarr1205](https://community.cesium.com/u/bhaskarr1205)\
**Post date:** [May 11, 2017, 6:17am UTC](https://community.cesium.com/t/how-to-get-positions-of-points-at-regular-intervals-at-a-particular-direction/3453/6 "2017-05-11T06:17:55Z")

</div>

Can you share sample code

---

<div class="post-metadata">

**Author:** ![Rachel\_Hwang](https://avatars.discourse-cdn.com/v4/letter/r/d78d45/32.png) [@Rachel\_Hwang](https://community.cesium.com/u/Rachel_Hwang)\
**Post date:** [May 11, 2017, 8:19pm UTC](https://community.cesium.com/t/how-to-get-positions-of-points-at-regular-intervals-at-a-particular-direction/3453/7 "2017-05-11T20:19:15Z")

</div>

Hi there,

Here’s a simple code example: [http://cesiumjs.org/Cesium/Apps/Sandcastle/?src=Hello%20World.html&label=Showcases&gist=5b8a00c55318737f13951039166cf588](http://cesiumjs.org/Cesium/Apps/Sandcastle/?src=Hello%20World.html&label=Showcases&gist=5b8a00c55318737f13951039166cf588)

Hope that helps!

- Rachel
