# Plot on Intersection Curves with adapted meshes

**URL:** https://discourse.paraview.org/t/plot-on-intersection-curves-with-adapted-meshes/8522
**Category:** ParaView Support
**Tags:** vtk
**Created:** [November 30, 2021, 7:55pm UTC](https://discourse.paraview.org/t/plot-on-intersection-curves-with-adapted-meshes/8522 "2021-11-30T19:55:03Z")
**Posts on this page:** 1
**Showing post:** 10

<div class="post-metadata">

### Author: ![Kenichiro-Yoshimi](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/k/ecc23a/32.png) [@Kenichiro-Yoshimi](https://discourse.paraview.org/u/Kenichiro-Yoshimi)
#### Post date: [December 3, 2021, 2:24am UTC](https://discourse.paraview.org/t/plot-on-intersection-curves-with-adapted-meshes/8522/10 "2021-12-03T02:24:46Z")

</div>

Thank you for sharing this information.

As for how to set the x-axis to arc length, it would be easy to implement this by creating your own polyline using the Programmable filter.

The following is the description of the **Programmable** filter in **Script**. Here, you need to specify **vtkPolyData** as **Output Data Set Type** of the programmable filter.

```python
import numpy as np

input = self.GetInputDataObject(0,0)
locator = vtk.vtkCellLocator()
locator.SetDataSet(input)
locator.BuildLocator()

# Setting Constants
tol = 1e-1
z = 0.5
start_phi = 0
end_phi = 2*np.pi
num_pts = 1000
theta = np.arcsin(z)
phi = np.linspace(start_phi, end_phi, num_pts, dtype=float)

# Calculate the point coordinates of a polyline
x = np.cos(theta)*np.cos(phi)
y = np.cos(theta)*np.sin(phi)
z = np.full(num_pts, z)

# Orthogonal projection of polyline points onto the analytical model
pts = vtk.vtkPoints()
cell_id = vtk.reference(0)
closest = [0.0]*3
sub_id = vtk.reference(0)
dist = vtk.reference(0.0)
for i in range(num_pts):
    locator.FindClosestPoint([x[i],y[i],z[i]], closest, cell_id, sub_id, dist)
    pts.InsertNextPoint(closest)

# Recreate a polyline based on orthogonal projection points
poly_line = vtk.vtkPolyData()
poly_line.SetPoints(pts)

pt_ids = vtk.vtkIdList()
pt_ids.SetNumberOfIds(num_pts)
for i in range(num_pts):
    pt_ids.SetId(i, i)
poly_line.Allocate(1)
poly_line.InsertNextCell(vtk.VTK_POLY_LINE, pt_ids)

# Interpolate the calculation results on the polyline
probe = vtk.vtkProbeFilter()
probe.SetInputData(poly_line)
probe.SetSourceData(input)
probe.SetTolerance(tol)
probe.ComputeToleranceOff()
probe.Update()

output.DeepCopy(probe.GetOutput())
output.PointData.append(phi, 'radians')

```

The following is the State file.  
[xaxis\_arc.pvsm](https://discourse.paraview.org/uploads/short-url/iCmIbiPUpU821Kt853DFfQ9h5ih.pvsm) (441.1 KB)

 ![xaxis_arc](https://discourse.paraview.org/uploads/default/original/2X/3/36a569e1bb9232bd860a0822a67ceb9d4ea45ad5.png)

---

_[View the full topic](https://discourse.paraview.org/t/plot-on-intersection-curves-with-adapted-meshes/8522)._
