# Interpolate from Mesh to arbitrary point

**URL:** https://community.freefem.org/t/interpolate-from-mesh-to-arbitrary-point/3776
**Category:** General Discussion
**Created:** [February 26, 2025, 4:59pm UTC](https://community.freefem.org/t/interpolate-from-mesh-to-arbitrary-point/3776 "2025-02-26T16:59:11Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![fem280w2](https://avatars.discourse-cdn.com/v4/letter/f/ed655f/32.png) [@fem280w2](https://community.freefem.org/u/fem280w2)
#### Post date: [February 26, 2025, 4:59pm UTC](https://community.freefem.org/t/interpolate-from-mesh-to-arbitrary-point/3776/1 "2025-02-26T16:59:11Z")

</div>

Dear All,

I apologize for being new to this software package. We would like to calculate particle trajectories and for this purpose we need to interpolate from a given mesh to an arbitrary, given point. I found various ways to interpolate between two different meshes, but couldn’t find any discussion for this specific question. Any suggestions would be very helpful to us.

Thank you in advance for your input.

---

<div class="post-metadata">

### Author: ![aszaboa](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/aszaboa/32/2918_2.png) [@aszaboa](https://community.freefem.org/u/aszaboa)
#### Post date: [February 26, 2025, 10:54pm UTC](https://community.freefem.org/t/interpolate-from-mesh-to-arbitrary-point/3776/2 "2025-02-26T22:54:16Z")

</div>

If your FE variable is `u`, then you can use `u(x0,y0,z0)` to extract the value at a certain point. As far as I know, it only does interpolation from the function values at the vertices, so its only P1 order.

---

<div class="post-metadata">

### Author: ![fem280w2](https://avatars.discourse-cdn.com/v4/letter/f/ed655f/32.png) [@fem280w2](https://community.freefem.org/u/fem280w2)
#### Post date: [February 27, 2025, 11:19am UTC](https://community.freefem.org/t/interpolate-from-mesh-to-arbitrary-point/3776/3 "2025-02-27T11:19:54Z")

</div>

Thank you very much for taking your time to answer this basic question! Is there any simple way that can interpolate with smooth derivatives without copying the entire mesh to an interpolating function?

---

<div class="post-metadata">

### Author: ![frederichecht](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/frederichecht/32/15_2.png) [@frederichecht](https://community.freefem.org/u/frederichecht)
#### Post date: [February 27, 2025, 12:28pm UTC](https://community.freefem.org/t/interpolate-from-mesh-to-arbitrary-point/3776/4 "2025-02-27T12:28:46Z")

</div>

I sorry , I do not understand what you want exactly. Can you explain want you want in math.

---

<div class="post-metadata">

### Author: ![fem280w2](https://avatars.discourse-cdn.com/v4/letter/f/ed655f/32.png) [@fem280w2](https://community.freefem.org/u/fem280w2)
#### Post date: [February 27, 2025, 12:58pm UTC](https://community.freefem.org/t/interpolate-from-mesh-to-arbitrary-point/3776/5 "2025-02-27T12:58:41Z")

</div>

Dear Frederic, thank you very much for your response. I would like to obtain the electric / magnetic field values at arbitrary points in space (x, y, z) via an interpolation from the mesh that ensures that both the field and their derivatives are smooth. Typically, nearest-neighbour interpolation from a discrete grid results in continuous functions with non-continuous first derivatives, so I wonder if the method described by aszaboa exhibits the same behaviour in general. I hope my question makes sense.

---

<div class="post-metadata">

### Author: ![frederichecht](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/frederichecht/32/15_2.png) [@frederichecht](https://community.freefem.org/u/frederichecht)
#### Post date: [February 27, 2025, 4:08pm UTC](https://community.freefem.org/t/interpolate-from-mesh-to-arbitrary-point/3776/6 "2025-02-27T16:08:32Z")

</div>

IN FreeFEM, the interpolation a just get the value of he finite element polynomial approximation,  
so generally you have only C0 regularity. If you want better your need to build a regular approximation of your data (this is not simple)

---

<div class="post-metadata">

### Author: ![fem280w2](https://avatars.discourse-cdn.com/v4/letter/f/ed655f/32.png) [@fem280w2](https://community.freefem.org/u/fem280w2)
#### Post date: [March 4, 2025, 1:14pm UTC](https://community.freefem.org/t/interpolate-from-mesh-to-arbitrary-point/3776/7 "2025-03-04T13:14:58Z")

</div>

Dear Frederic, thank you very much for your comments; at least it’s good to know that there is no straight-forward implementation that we have overlooked.
