# 3D coordinates from points equidistance along a curved path 

**URL:** https://discourse.slicer.org/t/3d-coordinates-from-points-equidistance-along-a-curved-path/31770
**Category:** Support
**Created:** [September 18, 2023, 12:54pm UTC](https://discourse.slicer.org/t/3d-coordinates-from-points-equidistance-along-a-curved-path/31770 "2023-09-18T12:54:18Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![sjang](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/sjang/32/67563_2.png) [@sjang](https://discourse.slicer.org/u/sjang)
#### Post date: [September 18, 2023, 12:54pm UTC](https://discourse.slicer.org/t/3d-coordinates-from-points-equidistance-along-a-curved-path/31770/1 "2023-09-18T12:54:18Z")

</div>

Along a curved path, I need the 3D coordinates (x, y, z) every 0.2mm.

In this post ([Create equidistant points along curve for automated measurements](https://discourse.slicer.org/t/create-equidistant-points-along-curve-for-automated-measurements/19870)), the solution to getting equidistant points is to resample by selecting the number of points to make along the already made curved path (i.e. 10 points along the curved path).

However, I want to make a point at a set distance (i.e. one point every 0.2mm along the curved path). Does anyone have any recommendations?

---

<div class="post-metadata">

### Author: ![Jeff\_Zeyl](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jeff_zeyl/32/70056_2.png) [@Jeff\_Zeyl](https://discourse.slicer.org/u/Jeff_Zeyl)
#### Post date: [September 18, 2023, 12:59pm UTC](https://discourse.slicer.org/t/3d-coordinates-from-points-equidistance-along-a-curved-path/31770/2 "2023-09-18T12:59:07Z")

</div>

With Python I believe you could use this function [How to resample curve nodes programmatically? - #4 by lassoan](https://discourse.slicer.org/t/how-to-resample-curve-nodes-programmatically/16395/4)

---

<div class="post-metadata">

### Author: ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)
#### Post date: [September 18, 2023, 1:08pm UTC](https://discourse.slicer.org/t/3d-coordinates-from-points-equidistance-along-a-curved-path/31770/3 "2023-09-18T13:08:45Z")

</div>

What is described in that post is applicable here, too. You can compute the number of points as: `CurveLength / 0.2 + 1`. If having less control points does not allow reproducing the curve shape with sufficient accuracy then you can use a smaller distance, such as `DesiredDistance`/`N`, and then use every `N`-th point.

You can of also get points at any distance along the curve using Python scripting. For example to get the 5th point with 0.2mm sampling distance:

```python
distance = 0.2 * 5
pointPosition = [0, 0, 0] # this will store the result
startingPointIndex = 0
getNode('OC').GetPositionAlongCurveWorld(pointPosition, startingPointIndex, distance)
print(p)

```

---

<div class="post-metadata">

### Author: ![Chuan](https://avatars.discourse-cdn.com/v4/letter/c/4da419/32.png) [@Chuan](https://discourse.slicer.org/u/Chuan)
#### Post date: [September 21, 2023, 7:43am UTC](https://discourse.slicer.org/t/3d-coordinates-from-points-equidistance-along-a-curved-path/31770/4 "2023-09-21T07:43:03Z")

</div>

Hi Jeff,

Have you used this function in python before? What I see here is coded by C++/C, does that mean I should call C function in python?

Best,  
Chuan

---

<div class="post-metadata">

### Author: ![Jeff\_Zeyl](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jeff_zeyl/32/70056_2.png) [@Jeff\_Zeyl](https://discourse.slicer.org/u/Jeff_Zeyl)
#### Post date: [September 22, 2023, 4:18pm UTC](https://discourse.slicer.org/t/3d-coordinates-from-points-equidistance-along-a-curved-path/31770/5 "2023-09-22T16:18:08Z")

</div>

It’s a python function. Another example: getNode(‘mycurve’).ResampleCurveWorld(1) will take your curve named ‘mycurve’ and resample it so points are 1 mm apart
