I’ve got a gradient vector field generated with -gradient -a[0,1,2]

but I’m looking for the tangent of that.

I mean if my vector is V(x,y) coordinates I’m looking for T=V crossproduct [0,0,1] that should be tangential to V.

I hope this make sense.

how could I do that ?

luc

# how to calculate gradient tangent ?

**luluxXX**#1

**David_Tschumperle**(David Tschumperlé) #2

I’m not sure what you want to do precisely, but you can easily compute the cross product between a vector-valued image (with 3 channels) and [0,0,1], like this:

```
$ gmic input image3channels.jpg fill "cross(I,[0,0,1])"
```

**luluxXX**#3

yes.this is exactly what I needed.thanks a lot , fill was the missing element.I got it now!

**David_Tschumperle**(David Tschumperlé) #4

Note also that for this particular case :

```
[ X Y Z ] x [ 0 0 1 ] = [ -Y X 0 ]
```

So computing this particular cross product is faster with:

```
fill "[ -G R 0 ]"
```