sfstoolbox / sfs-python

SFS Toolbox for Python

Home Page:https://sfs-python.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use "view" and "up" vectors?

mgeier opened this issue · comments

If we want to describe objects (e.g. loudspeakers) in space unambiguously, our current "position" and "orientation" might not be enough.

We would probably also need some kind of "up" vector to specify the sixth degree of freedom.

Will this be necessary?

Or use quaternions? Those are always fun ...

We could probably even allow both ... "view" vectors (with 3 elements) for the simple cases and quaternions (with 4 elements) for the general case.
The problem is that we would have to decide which one to return from functions.

Could you give an example where a (x, y, z) and (nx, ny, nz) are not enough to describe the loudspeaker.
Or is orientation not considered to be a directional vector?

Sorry, loudspeakers weren't really a good example. Unless they have a strange non-circular pattern around their main axis, it doesn't make a difference.
It would mainly make a difference if we would include somewhat naturalistic depictions of loudspeakers in our plots. There it would make a difference if they are upright or tilted to the side.

It would, however, make a difference for the orientation of loudspeaker arrays.
For example, the orientation argument of sfs.array.linear and sfs.array.rectangular might be ambiguous, because there is one degree of freedom that's not specified explicitly.
In most cases, the current behavior will be what you want, but if you turn the array to some extreme orientations (e.g. straight up), it might not work as expected.

The sixth degree of freedom might also matter if we ever support arbitrary measured directivities.

Another example is sfs.mono.source.line(), which is currently defined as parallel to the z-axis. We could allow arbitrary orientation, but I don't know if we really want that.

I'm not sure if those situations will ever come up in our usage, I just wanted to raise awareness and discuss the possibility.

Or is orientation not considered to be a directional vector?

It is. It's just leaving the sixth degree of freedom unspecified, I should have given a more meaningful example.

Ah, ok, I see your point. I was not thinking about a real loudspeaker, but the calculations in the driving functions involving loudspeakers.

For a line source a simple orientation vector should also be fine for handling that one, see also http://sfstoolbox.org/en/latest/#equation-v.ls
If I remember correctly the orientation vector is parallel to the line in this case and it is implemented for WFS in Matlab.

If I remember correctly the orientation vector is parallel to the line in this case and it is implemented for WFS in Matlab.

Unfortunately it does not work that well.

It is working in the sense that we need only (x,y,z) and (nx,ny,nz). But I guess you are referring to the problem is that for the secondary sources (nx,ny,nz) is used as direction, whereas for the line source (nx,ny,nz) is used as orientation which is inconsistent. Aren't you?

Exactly. As a result, we cannot use arbitrary line sources as secondary sources (Green's functions).
The line source's "orientation" should rather be a separate "up vector".

Using the orientation argument to be parallel to the line source is simply a hack, somewhat abusing a given API.

It probably needs fewer arguments here and there and we can save a few numbers.
It may be less confusing in many cases, it may be more confusing in a few other cases.
And the result may be good enough for us.

However, we are losing generality and may run into problems, as @trettberg pointed out.
It might have a higher cost in complexity to achieve generality, we'll have to choose our trade-off ...

I would prefer a solution with two vectors, i.e. "front-view" and "up". Although quaternions are really nice for describing rotations, it is not worth the effort imho.