# Calculation of surface tangents error

**URL:** https://discourse.paraview.org/t/calculation-of-surface-tangents-error/9052
**Category:** ParaView Support
**Created:** [February 24, 2022, 10:08am UTC](https://discourse.paraview.org/t/calculation-of-surface-tangents-error/9052 "2022-02-24T10:08:03Z")
**Posts on this page:** 17
**Page:** 1

<div class="post-metadata">

### Author: ![GKk](https://discourse.paraview.org/user_avatar/discourse.paraview.org/gkk/32/8235_2.png) [@GKk](https://discourse.paraview.org/u/GKk)
#### Post date: [February 24, 2022, 10:08am UTC](https://discourse.paraview.org/t/calculation-of-surface-tangents-error/9052/1 "2022-02-24T10:08:03Z")

</div>

Hello,

I want to apply the filter “Generate Surface Tangents” on a surface and I get the following error (attached picture)

![error](https://discourse.paraview.org/uploads/default/original/2X/f/f78f0d2a56ed0ba7b1060b7c738044c23332e908.png)

The filter “Generate Surface Nomrlas” works fine. What I have to do for “Generate Surface Tangents” filter?

Thanks

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [February 24, 2022, 12:50pm UTC](https://discourse.paraview.org/t/calculation-of-surface-tangents-error/9052/2 "2022-02-24T12:50:18Z")

</div>

please share your data

---

<div class="post-metadata">

### Author: ![GKk](https://discourse.paraview.org/user_avatar/discourse.paraview.org/gkk/32/8235_2.png) [@GKk](https://discourse.paraview.org/u/GKk)
#### Post date: [February 24, 2022, 2:16pm UTC](https://discourse.paraview.org/t/calculation-of-surface-tangents-error/9052/3 "2022-02-24T14:16:10Z")

</div>

Thanks for the reply. Do you mean to share pictures or data?

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [February 24, 2022, 2:17pm UTC](https://discourse.paraview.org/t/calculation-of-surface-tangents-error/9052/4 "2022-02-24T14:17:49Z")

</div>

your actual data.

---

<div class="post-metadata">

### Author: ![GKk](https://discourse.paraview.org/user_avatar/discourse.paraview.org/gkk/32/8235_2.png) [@GKk](https://discourse.paraview.org/u/GKk)
#### Post date: [February 24, 2022, 3:02pm UTC](https://discourse.paraview.org/t/calculation-of-surface-tangents-error/9052/5 "2022-02-24T15:02:36Z")

</div>

Here you can download the [Data](https://drive.google.com/drive/folders/1LifPK7bvt3eKbrHhcD5Sxv6CdSsGuLTG?usp=sharing). Actually I want to calculate the normal and the tangent vectors on the wall surface of my geometry.

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [February 24, 2022, 3:04pm UTC](https://discourse.paraview.org/t/calculation-of-surface-tangents-error/9052/6 "2022-02-24T15:04:16Z")

</div>

I just requested access

---

<div class="post-metadata">

### Author: ![GKk](https://discourse.paraview.org/user_avatar/discourse.paraview.org/gkk/32/8235_2.png) [@GKk](https://discourse.paraview.org/u/GKk)
#### Post date: [February 24, 2022, 3:10pm UTC](https://discourse.paraview.org/t/calculation-of-surface-tangents-error/9052/7 "2022-02-24T15:10:52Z")

</div>

I gave you access 🙂 !

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [February 24, 2022, 3:54pm UTC](https://discourse.paraview.org/t/calculation-of-surface-tangents-error/9052/8 "2022-02-24T15:54:00Z")

</div>

Your data does not have any TCoords, so tangents vectors cant be computed.

What are you trying to achieve ?

---

<div class="post-metadata">

### Author: ![GKk](https://discourse.paraview.org/user_avatar/discourse.paraview.org/gkk/32/8235_2.png) [@GKk](https://discourse.paraview.org/u/GKk)
#### Post date: [February 24, 2022, 4:01pm UTC](https://discourse.paraview.org/t/calculation-of-surface-tangents-error/9052/9 "2022-02-24T16:01:42Z")

</div>

What are TCoords? I want to take slices on the cross section like this

![slice](https://discourse.paraview.org/uploads/default/original/2X/e/e1752e23a17eb4fc2fabce0d127ee3a7f3a27505.png)

To achieve that I have to know the tangent vector on the surface point (like this in picture) in order to make a slice paralllel to each cross section of the curved part. Then I want to take the dot product of the velocity vector with the normal vector on the surface point in order to calculate the flow on this plane (slice).

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [February 24, 2022, 4:05pm UTC](https://discourse.paraview.org/t/calculation-of-surface-tangents-error/9052/10 "2022-02-24T16:05:55Z")

</div>

> [@GKk](#):
>
> Then I want to take the dot product of the velocity vector with the normal vector on the surface point in order to calculate the flow on this plane (slice).

Just compute that with a calculator

---

<div class="post-metadata">

### Author: ![GKk](https://discourse.paraview.org/user_avatar/discourse.paraview.org/gkk/32/8235_2.png) [@GKk](https://discourse.paraview.org/u/GKk)
#### Post date: [February 24, 2022, 4:08pm UTC](https://discourse.paraview.org/t/calculation-of-surface-tangents-error/9052/11 "2022-02-24T16:08:38Z")

</div>

Yes I know that but my problem is how to produce slices parallel to each cross section like this in the picture? That is my problem, because the slice has to have an arbitrary direction to be parallel to the cross section. This direction is the tangent vector of a point on the outer slice surface

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [February 24, 2022, 4:11pm UTC](https://discourse.paraview.org/t/calculation-of-surface-tangents-error/9052/12 "2022-02-24T16:11:43Z")

</div>

> [@GKk](#):
>
> This direction is the tangent vector of a point on the outer slice surface

Just compute what you need with a calculator.

FYI @timothee.chabat

---

<div class="post-metadata">

### Author: ![timothee.chabat](https://discourse.paraview.org/user_avatar/discourse.paraview.org/timothee.chabat/32/5729_2.png) [@timothee.chabat](https://discourse.paraview.org/u/timothee.chabat)
#### Post date: [February 24, 2022, 4:15pm UTC](https://discourse.paraview.org/t/calculation-of-surface-tangents-error/9052/13 "2022-02-24T16:15:08Z")

</div>

I don’t quite get the issue here. A tangent at a surface for a given point is a plane. The only thing you need to fully define a plane is a normal vector and a point. If your data doesn’t have a normal then you can just create one using the `Generate Surface Normals` filter.

What behavior are you expecting from the `Generate Surface Tangent` exactly ?

---

<div class="post-metadata">

### Author: ![GKk](https://discourse.paraview.org/user_avatar/discourse.paraview.org/gkk/32/8235_2.png) [@GKk](https://discourse.paraview.org/u/GKk)
#### Post date: [February 24, 2022, 4:28pm UTC](https://discourse.paraview.org/t/calculation-of-surface-tangents-error/9052/14 "2022-02-24T16:28:41Z")

</div>

So lets make it clear.

I have the following geometry

![slice](https://discourse.paraview.org/uploads/default/original/2X/e/e1752e23a17eb4fc2fabce0d127ee3a7f3a27505.png)

I want to make slices on the curved part. To do this I need a point P (ok this is easy) and a normal vector V\_s to define the plane. For the slice to be parallel to the cross section like this in the first picture, we have to know the tangent vector on the point P we selected. In other case we will have something like that

 ![slice2](https://discourse.paraview.org/uploads/default/original/2X/0/00ad2a04e38645feb6739c1ef606db450d4bd943.png)

which is wrong because the slice does not follow the arc properly. The normal vector V\_s is the tangent vector on point P like this

 ![slice3](https://discourse.paraview.org/uploads/default/original/2X/5/5d39383d32534125d197cdf5135c67c002feb979.png)

So my question is how to know the vector V\_s.

---

<div class="post-metadata">

### Author: ![timothee.chabat](https://discourse.paraview.org/user_avatar/discourse.paraview.org/timothee.chabat/32/5729_2.png) [@timothee.chabat](https://discourse.paraview.org/u/timothee.chabat)
#### Post date: [February 24, 2022, 4:51pm UTC](https://discourse.paraview.org/t/calculation-of-surface-tangents-error/9052/15 "2022-02-24T16:51:31Z")

</div>

> [@GKk](#):
>
> we have to know the tangent vector on the point P we selected.

Actually there is an infinity of tangent vector at point P, but I get what you want. What you really want is the tangent of the center of your geometry (ie the red line on your schema), because the tangent of a line is a vector and not a plane. There is no way of computing this “center of geometry” line using existing ParaView filters AFAIK so as Mathieu said, you can just compute what you want manually using the python calculator.

Also note that although it’s easy to create multiple slices that have the same normal, it’s not trivial when they’re not the same, as it is in your case. You’d have to create a slice filter for each slice with a different normal.

In the end: there’s no existing filters or smart workaround for your use case AFAIK. You can always try to hack your way around by using the python calculator or by creating your own plugin.

---

<div class="post-metadata">

### Author: ![GKk](https://discourse.paraview.org/user_avatar/discourse.paraview.org/gkk/32/8235_2.png) [@GKk](https://discourse.paraview.org/u/GKk)
#### Post date: [February 24, 2022, 5:44pm UTC](https://discourse.paraview.org/t/calculation-of-surface-tangents-error/9052/16 "2022-02-24T17:44:31Z")

</div>

Thank you very much for your answer. Yes I understand that there is an infinity of tangent vectors but I thought that paraview could handle this issue. I will make a custom code with python. Thanks again

---

<div class="post-metadata">

### Author: ![timothee.chabat](https://discourse.paraview.org/user_avatar/discourse.paraview.org/timothee.chabat/32/5729_2.png) [@timothee.chabat](https://discourse.paraview.org/u/timothee.chabat)
#### Post date: [February 25, 2022, 9:19am UTC](https://discourse.paraview.org/t/calculation-of-surface-tangents-error/9052/17 "2022-02-25T09:19:36Z")

</div>

No problem 🙂

side note : you can also take a look at the `Slice Along Polyline` filter, it could be usefull for your use case
