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

fred18

Addon Developer
Addon Developer
Donator
Joined
Feb 2, 2012
Messages
1,667
Reaction score
104
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:

Donamy

Addon Developer
Addon Developer
Donator
Beta Tester
Joined
Oct 16, 2007
Messages
6,906
Reaction score
201
Points
138
Location
Cape
What does it cause ?
 

Face

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 18, 2008
Messages
4,398
Reaction score
578
Points
153
Location
Vienna
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.
 

kuddel

Donator
Donator
Joined
Apr 1, 2008
Messages
2,064
Reaction score
507
Points
113
@martins: Should we create an "official" issue here for this, so it doesn't get lost?
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,605
Reaction score
2,327
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
I wonder - could this maybe cause strangeness in the animations? Those vectors and matrixes are usually used for affine transformations.
 

fred18

Addon Developer
Addon Developer
Donator
Joined
Feb 2, 2012
Messages
1,667
Reaction score
104
Points
78
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...
 

jarmonik

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 28, 2008
Messages
2,666
Reaction score
795
Points
128
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.
 

GLS

Well-known member
Orbiter Contributor
Addon Developer
Joined
Mar 22, 2008
Messages
5,914
Reaction score
2,908
Points
188
Website
github.com
I didn't say it at the time, but SSU is also clear.
 

GLS

Well-known member
Orbiter Contributor
Addon Developer
Joined
Mar 22, 2008
Messages
5,914
Reaction score
2,908
Points
188
Website
github.com
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.
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,605
Reaction score
2,327
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
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:
 

jedidia

shoemaker without legs
Addon Developer
Joined
Mar 19, 2008
Messages
10,862
Reaction score
2,127
Points
203
Location
between the planets
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:


Software development is when it doesn't work, and you don't know why ;)
 

kuddel

Donator
Donator
Joined
Apr 1, 2008
Messages
2,064
Reaction score
507
Points
113
Can we please stay focused (on topic)
 
Top