# How could project a 3D point to a vtkParametricSpline

**URL:** https://discourse.vtk.org/t/how-could-project-a-3d-point-to-a-vtkparametricspline/13442
**Category:** Support
**Tags:** python
**Created:** [March 4, 2024, 9:47pm UTC](https://discourse.vtk.org/t/how-could-project-a-3d-point-to-a-vtkparametricspline/13442 "2024-03-04T21:47:14Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Anderson\_Madureira](https://discourse.vtk.org/user_avatar/discourse.vtk.org/anderson_madureira/32/8561_2.png) [@Anderson\_Madureira](https://discourse.vtk.org/u/Anderson_Madureira)
#### Post date: [March 4, 2024, 9:47pm UTC](https://discourse.vtk.org/t/how-could-project-a-3d-point-to-a-vtkparametricspline/13442/1 "2024-03-04T21:47:14Z")

</div>

Hello,

I´ve created a vtkParametricSpline() and after I inserted some vtkPoints():

pts=np.loadtxt(‘evalPts.txt’,delimiter=‘,’)  
spl=vtkParametricSpline()  
spline\_points = vtkPoints()  
for pt in pts:  
spline\_points.InsertNextPoint(pt)  
spl.SetPoints(spline\_points)

Now, I´d like to project a very close 3Dpoint over this vtkParametricSpline and get the coordinates of this projection.

How can I do it, please?

Thanks!

---

<div class="post-metadata">

### Author: ![oyster](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/o/a4c791/32.png) [@oyster](https://discourse.vtk.org/u/oyster)
#### Post date: [March 6, 2024, 2:45am UTC](https://discourse.vtk.org/t/how-could-project-a-3d-point-to-a-vtkparametricspline/13442/2 "2024-03-06T02:45:57Z")

</div>

A trivial way: generate a spline (vtkSplineFilter, a polyline), build a vtkCellLocator, and find the ClosestPoint on the exact line segment with (x,y,z) coordinates rather than parametric coordinates.
