Can you vote for this Quality report, please?

Can you vote for this Quality report, please? It's a serious issue where math done with TVector3D gives the wrong results - completely wrong. The reason is that it is not a 3D vector, despite its name, but a 4D vector. Any normal math you do, such as adding a scaled vector to a 3D point, gives the wrong result.

Eg, for the expression "Pt3D + Vec3D * Scalar" where Pt3D is TPoint3D.Create(0,0,0), Vec3D is TVector3D.Create(1,0,0) and Scalar is Single = 12, you would expect a resulting 3D point value of (12,0,0), right? No. You get (1,0,0). Which is wrong.

Even worse, TPoint3D is the stand-in for a real 3D vector. System.Math.Vectors goes so far as to deprecate vector operations like a cross product on the vector type, and puts them on the point type instead - something that makes no sense.

Reading this code with some knowledge of 3D math makes my head hurt. Using it is even worse (I just fixed several bugs by replacing my usage of TVector3D with TPoint3D, despite wanting a 3D vector, and looking at the RTL/FMX (and now my) code where things are cast to and from points and vectors just to get the right behaviour... argh.) However, it can be improved easily, and there are recommendations for the appropriate changes in the Quality report. There is also a simple console program attached to the report showing both the expected and incorrect behaviours.

https://quality.embarcadero.com/browse/RSP-9749
https://quality.embarcadero.com/browse/RSP-9749

Comments