Error Spotted Error in OrbiterAPI.h -> Vector4 Matrix4 multiplication

fred18

Addon Developer
Addon Developer
Donator
Joined
Feb 2, 2012
Messages
1,667
Reaction score
115
Points
78
Hi all,

Just to tell that I spotted an error in OribterApi.h. It came out because my matrix4 - vector4 multiplication was not right and I was getting crazy, so i tracked down this:

from OrbiterApi.h
Code:
inline VECTOR4 mul (const MATRIX4 &A, const VECTOR4 &b)
{
	return _V (
		A.m11*b.x + A.m12*b.y + A.m13*b.z + A.m14*b.w,
		A.m21*b.x + A.m22*b.y + A.m23*b.z + A.m24*b.w,
		A.m31*b.x + [B][COLOR="Red"]A.m23*b.y [/COLOR][/B]+ A.m33*b.z + A.m34*b.w,
		A.m41*b.x + A.m42*b.y + A.m43*b.z + A.m44*b.w);
}

The red should be A.m32, not m23, so I suggest to those who are using this to implement their version until this is getting corrected by martin.

Note: I found it in both Orbiter 2016 version and Orbiter BETA version of OrbiterApi.h

Cheers :cheers:

Fred
 
Last edited:
What does it cause ?
 
Hey, well spotted! How can that have slipped through for so long :blink:

I can only guess that not too many used the VECTOR4 class, but just VECTOR3.
 
@martins: Should we create an "official" issue here for this, so it doesn't get lost?
 
I wonder - could this maybe cause strangeness in the animations? Those vectors and matrixes are usually used for affine transformations.
 
I wonder - could this maybe cause strangeness in the animations? Those vectors and matrixes are usually used for affine transformations.

That's how i picked it up: I was reconstructing animations' transformation matrixes and something was not right, like some groups not being animated correctly (but not all), even though i was sure that my calculations were right...
 
I checked the D3D9Client code and couldn't found any uses of the faulty mul() function. There should be no impact in animations under D3D9.
 
I didn't say it at the time, but SSU is also clear.
 
Ah, those moments when you ask yourself how anything ever worked in the first place... :lol:

If it had been the 3 dimension version, then it really would be interesting.
 
Ah, those moments when you ask yourself how anything ever worked in the first place... :lol:

Theory is, if you know how it should work, and it doesn't.
Reality is, if you know it should not work, and does. :lol:
 
Can we please stay focused (on topic)
 
Back
Top