I have seen that TVector3 is now obsolete and we should migrate to XYZVector. While doing that in our code I do not find an equivalent for the `TVector3::Orthogonal`

Also I am having issues finding a replacement for `TVector3::Rotate( Double_t angle, TVector3 axis )`

which rotates a given vector by a given `angle`

around a given `axis`

.

I was having a look at the following post that didn’t clarify much

Hello,

For rotate a vector along an axis and an angle you can use the `AxisAngle`

class.

Here is an examples:

```
using namespace ROOT::Math;
XYZVector axis(ax,ay,az);
AxisAngle rot(axis,angle);
XYZVector originalVector(x,y,z);
XYZVector rotatedVector = rot(originalVector);
```

For `Vector::Orthogonal`

we don’t have a replacement, I am actually not sure what it is returned, since given a 3D vector, there is an infinite number of orthogonal vectors belonging to the orthogonal plance.

Lorenzo

Yes, there are infinite ones, it sounds weird but I just need one of them, no matter which one. Just making sure that it is contained in the plane is enough.

The implementation at `TVector3`

.

```
inline TVector3 TVector3::Orthogonal() const {
Double_t xx = fX < 0.0 ? -fX : fX;
Double_t yy = fY < 0.0 ? -fY : fY;
Double_t zz = fZ < 0.0 ? -fZ : fZ;
if (xx < yy) {
return xx < zz ? TVector3(0,fZ,-fY) : TVector3(fY,-fX,0);
} else {
return yy < zz ? TVector3(-fZ,0,fX) : TVector3(fY,-fX,0);
}
}
```

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.